用编程抓小偷
用編程抓小偷
題目:
a,b,c,d 4名為犯罪嫌疑人,有一名是小偷,其中3個人說的是實話,一個人說的是假話,編程推斷誰是小偷。
a說我不是小偷
b說c是小偷
c說小偷肯定是d
d說c胡說!
for thief in ['a','b','c','d']:t = (thief != 'a') + (thief == 'c') + (thief == 'd') + (thief !='d')if t == 3:print ("小偷是:%s " % thief)?
posted on 2017-06-13 16:25 Gino森 閱讀(...) 評論(...) 編輯 收藏轉載于:https://www.cnblogs.com/kearney908/p/7001964.html
總結
- 上一篇: 微软CEO纳德拉拥抱Linux意欲何为?
- 下一篇: 王者荣耀镜头灵敏度设置多少合适