当前位置:网站首页>C language antithesis: who is the murderer!
C language antithesis: who is the murderer!
2022-08-11 04:55:00 【so-and-so Xiaolu】
The complete code is at the end!
Title description
A murder case occurred somewhere in Japan, and the police determined that the murderer must be one of four suspects through investigation.
The following are the confessions of the four suspects:
A said: Not me.
B said: yes C.
C said: yes D.
D said: C is talking nonsense
3 people are known to tell the truth and 1 person to tell the truth.
Now, based on this information, write a program to determine who the killer is.
Solution ideas
In this question, only one person told a lie and 3 people told the truth. We can return 1 for each time the truth is judged. Three times the truth is three 1s equal to 3. We can use each time to assume that a certain person is the murdererto judge whether what everyone said is the truth.So use the for statement to go from the murderer a to the murderer d, and each judgment is ok

Complete code
#includeint main(){char m;for (char i = 'a'; i <= 'd'; i++){if ((i != 'a') + (i == 'c') + (i == 'd') + (i != 'd') == 3){printf("%c", i);}}return 0;} 边栏推荐
- The shortest path out of the maze
- 交换机和路由器技术-31-扩展ACL
- ALSA音频架构 -- aplay播放流程分析
- 0 Basic software test for career change, self-study for 3 months, 12k*13 salary offer
- Overview of the JVM garbage collection and mechanism
- 交换机和路由器技术-33-静态NAT
- 交换机和路由器技术-29-OSPF虚链路
- 交换机和路由器技术-26-OSPF末梢区域配置
- [Server installation mysql] Use mysql offline installation package to install mysql5.7 under centos7
- Australia cyberspace security system construction
猜你喜欢
随机推荐
The sword refers to offer_abstract modeling capabilities
标识密码技术在 IMS 网络中的应用
CAD2020 打开错误报告 e06d7363h Exception at 13644F69h
To break the bottleneck of transactional work, the gentleman signs the electronic contract to release the "source power" of HR!
About the pom.xml file
Network Skill Tree
【ImageNet】数据集1000个类的名称
The principle, architecture, implementation, practice of "transfer" and "search", no need to be afraid of interviews
Switch and Router Technology - 28 - NSSA Areas for OSPF
How IP-Guard prohibits running U disk programs
C语言:实用调试技巧
How to switch Green Shield encryption to IP-Guard encryption smoothly
如何阅读论文
堆排序 和冒泡排序
Mysql中事件和定时任务
网络安全培训机构哪家好?排名怎么选择?
网络技能树
增加PRODUCT_BOOT_JARS及类 提供jar包给应用
Switches and routers technology - 24 - configure OSPF single area
关于CC 攻击









