当前位置:网站首页>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;
}边栏推荐
- Using recursive functions to solve the inverse problem of strings
- OpenShift 容器平台社区版 OKD 4.10.0部署
- Minecraft plug-in service opening
- Sentinel 简单使用
- Solution and analysis of Hanoi Tower problem
- Gateway is easy to use
- commands out of sync. did you run multiple statements at once
- Honeypot attack and defense drill landing application scheme
- gocv opencv exit status 3221225785
- HCIA—应用层
猜你喜欢
随机推荐
Service de groupe minecraft
Function ‘ngram‘ is not defined
统计字符串中各类字符的个数
Qt——如何在QWidget中设置阴影效果
History of Web Technology
zipkin 简单使用
Flex layout
Openshift deployment application
QT drag event
汉诺塔问题的求解与分析
OpenFeign 简单使用
kubernetes部署loki日志系统
Realization of basic function of sequence table
Routing foundation - dynamic routing
Solution of Xiaomi TV's inability to access computer shared files
Using recursive functions to solve the inverse problem of strings
Kubedm deploys kubernetes v1.23.5 cluster
OpenShift 容器平台社区版 OKD 4.10.0部署
Qt QTimer类
Data asset management function









