解题思路:
注意事项:
其实丁说的判断条件可有可无,因此代码把这部分注释掉了,若加上,则需删除后面的一行 matched_intel += 1
参考代码:
for i in range(4): suspect = [0 for _ in range(4)] matched_intel, suspect[i] = 0, 1 if (suspect[1] == 0 and suspect[3] == 1) or \ (suspect[1] == 1 and suspect[3] == 0): matched_intel += 1 if (suspect[1] == 0 and suspect[2] == 1) or \ (suspect[1] == 1 and suspect[2] == 0): matched_intel += 1 if (suspect[0] == 0 and suspect[1] == 1) or \ (suspect[0] == 1 and suspect[1] == 0): matched_intel += 1 # if suspect[3] == 0 or suspect[3] == 1: # matched_intel += 1 matched_intel += 1 if matched_intel == 4: res = dict(zip(suspect, "ABCD")) print(res[suspect[i]]) break
0.0分
0 人评分
点我有惊喜!你懂得!浏览:3870 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:605 |
简单的a+b (C语言代码)浏览:759 |
C语言程序设计教程(第三版)课后习题9.8 (Java代码)浏览:1635 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1294 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1107 |
wu-理财计划 (C++代码)浏览:827 |
三角形 (C++代码)递归(存在大量重复计算,容易出现时间超限)浏览:774 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:347 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:598 |