当前位置:网站首页>C language - Blue Bridge Cup - 7 segment code
C language - Blue Bridge Cup - 7 segment code
2022-07-02 08:57:00 【@Xiaoyu~】

1. Import header file

2. Use enumeration to solve problems ( This question focuses on drawing )

3. The answer for 80

4. The attached total code is as follows
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
int sum = 0;
// Case one , Only one segment of diode emits light
int l1 = 7;//(a,b,c,d,e,f,g)
// The second case , There are two LEDs
int l2 = 10;//(ab,af,bc,bg,cg,cd,de,eg,ef,fg)
// The third case , There are three LEDs
int l3 = 16;//(abf,abc,abg,afg,afe,bcd,bcg,bgf,bge,cgd,cgf,cge,cde,cdg,deg,def,efg)
// The fourth situation , There are four LEDs
int l4 = 20;//(abcd,abcg,abcf,abge,abgf,abfe,afeg,bcde,bcdg,bcgf,bcge,bged,bgef,cdef,
//cdeg,cdgf,cgfa,cgfe,defg,defa)
// The fifth situation , There are five diodes that light up
int l5 = 19;//( Look for one with no light at both ends :ab,ac,ad,ae,af,ag,bc,bd,be,bg,cd,cf,cg,de,df,dg,ef,eg,fg)
// Sixth situation , There are six segments of diode light
int l6 = 7;//( Find a section of diode that doesn't light up :a,b,c,d,e,f,g)
// Situation 7 , All glow
int l7 = 1;//(abcdefg)
// Total statistics
sum = l1 + l2 + l3 + l4 + l5 + l6 + l7;
printf("%d\n", sum);
return 0;
}边栏推荐
猜你喜欢
随机推荐
File upload Labs
C# 高德地图 根据经纬度获取地址
一个经典约瑟夫问题的分析与解答
HCIA—应用层
Qt的右键菜单
gocv边界填充
gocv opencv exit status 3221225785
Web security -- Logical ultra vires
C call system sound beep~
QT -- how to set shadow effect in QWidget
C# 将网页保存为图片(利用WebBrowser)
Essay: RGB image color separation (with code)
Network security - summary and thinking of easy-to-use fuzzy tester
整理秒杀系统的面试必备!!!
选择排序和插入排序
Zipkin is easy to use
Minecraft群組服開服
Synchronize files using unison
Application of kotlin - higher order function
Npoi export word font size correspondence



![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)





