随笔- 509  文章- 0  评论- 151  阅读- 22万 

2014-03-20 01:02

题目:无力描述的一道智力题,真是货真价实的智力题,让我充分怀疑自己智力的智力题。有兴趣的还是看书去吧。

解法:能把题目看懂,你就完成80%了,用反证法吧。

代码:

复制代码
 1 // 6.4 There is an island with a bunch of people living there.
 2 // The strange thing is, any blue-eyed tourists must leave immediately when they find out they're blue-eyed.
 3 // Everyone can see others' eye colors, but not their own.
 4 // They know there'll be at least one blue-eyed tourists. If no more, the game ends.
 5 // Answer:
 6 //    Suppose there're n people and c are blue-eyed.
 7 //    If n == 1, that one will soon find out nobody else is blue-eyed, he'll leave on the 1st day.
 8 //    If n == 2, those two will see one blue-eyed, they are not sure if c == 1 or c == 2.
 9 //    But on the second day, when they still see each other, they know c == 2. Otherwise the one would have left. They'll leave on the 2nd day.
10 //    With mathematical induction, it can be proven that all the c blue-eyed will leave on the cth day together.
11 //    The most difficult part for me, is that when they can't be sure, they will simply stay. I thought every day there must've been someone leaving.
12 int main()
13 {
14     return 0;
15 }
复制代码

 

 posted on   zhuli19901106  阅读(244)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示