TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

100 Prisoners and a Lamp

39 点作者 C--超过 11 年前

4 条评论

popularopinion超过 11 年前
This puzzle has been on the XKCD puzzles wiki for several years. They have some very fun puzzles there. It&#x27;s a huge timewaster, so only click if you have nothing pressing to do. <a href="http://wiki.xkcd.com/irc/puzzles#Prisoners" rel="nofollow">http:&#x2F;&#x2F;wiki.xkcd.com&#x2F;irc&#x2F;puzzles#Prisoners</a><p>If you need help on any of the puzzles, hints and answers are on the talk page. For this specific puzzle, the talk page links to a paper by William Wu that answers this exact question with asymptotic analysis.<p><a href="http://www.ocf.berkeley.edu/~wwu/papers/100prisonersLightBulb.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ocf.berkeley.edu&#x2F;~wwu&#x2F;papers&#x2F;100prisonersLightBul...</a>
评论 #6792068 未加载
throwaway0094超过 11 年前
Give everyone a unique number during the planning phase. Have everyone scratch their number into the wall. Leave the light on.<p>When all numbers are on the wall, you are done.
评论 #6792685 未加载
评论 #6792033 未加载
评论 #6792201 未加载
评论 #6792004 未加载
brainburn超过 11 年前
The problem description could be a bit clearer. What exactly are the rules?
评论 #6791923 未加载
adam-f超过 11 年前
This reminds me of a problem I learned in UCSC (and was accused of cheating by the teacher when I figured it out in five minutes).<p>100 Prisoners are told they will be given white or black hats, but they don&#x27;t get to see the hat they&#x27;re wearing, they will be lined up facing the same direction, and they gun-to-the-head, say &quot;black&quot; or &quot;white&quot; and if they guess the color of their hat, they get to live.<p>They get to speak back to front, i.e., the rearmost prisoner sees all the hats ahead.<p>One strategy for optimizing the number left is to speak the color of the hat directly in front of you, in which case the prisoner ahead gets to live by repeating that color. This saves 50%, but of course there&#x27;s a better solution.
评论 #6792003 未加载