当前位置:网站首页>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;
}边栏推荐
猜你喜欢

Service de groupe minecraft

Minecraft module service opening

Minecraft群组服开服

ICMP Protocol

MYSQL安装出现问题(The service already exists)

小米电视不能访问电脑共享文件的解决方案

Programmer training, crazy job hunting, overtime ridiculed by colleagues deserve it

commands out of sync. did you run multiple statements at once

Application of kotlin - higher order function

What is SQL injection
随机推荐
C# 百度地图,高德地图,Google地图(GPS) 经纬度转换
Web security -- core defense mechanism
OpenShift 容器平台社区版 OKD 4.10.0部署
Right click menu of QT
Web security -- Logical ultra vires
Image transformation, transpose
Qt的拖动事件
C # save web pages as pictures (using WebBrowser)
C Gaode map obtains the address according to longitude and latitude
统计字符串中各类字符的个数
Pointer initialization
kubernetes部署loki日志系统
gocv opencv exit status 3221225785
Nacos 下载启动、配置 MySQL 数据库
Solution and analysis of Hanoi Tower problem
Linux二进制安装Oracle Database 19c
一个经典约瑟夫问题的分析与解答
Zipkin is easy to use
OpenShift构建镜像
QT -- how to set shadow effect in QWidget