解题思路:
注意事项:
其实丁说的判断条件可有可无,因此代码把这部分注释掉了,若加上,则需删除后面的一行 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 人评分
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:590 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:689 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:771 |
字符串输入输出函数 (C++代码)(都当成字符串吧hhhhhhhh)浏览:511 |
C二级辅导-阶乘数列 (C语言代码)浏览:736 |
WU-蓝桥杯算法提高VIP-企业奖金发放 (C++代码)浏览:1270 |
校门外的树 (C语言代码)浏览:733 |
1025题解浏览:798 |
GC的苦恼 (C语言代码)浏览:673 |
剪刀石头布 (C语言代码)浏览:1521 |