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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

100 Prisoners, 100 lines of code

43 点作者 ulvund超过 14 年前

5 条评论

aidenn0超过 14 年前
Here's a new brain teaser. The warden is a mathematician, and instead of arranging them randomly, he ensures that there is a cycle of at least 51. However he's not too cruel, so he tells the prisoners that he has done this.<p>I'm pretty sure that since this is less random than the original version the survival rate would go up, but I haven't figured out how to do this.
评论 #1653408 未加载
donaldc超过 14 年前
If the boxes are in a random jumble when the prisoner enters, there may be no practical way of having 100 prisoners consistently assign an ordering from 1 to 100 for the boxes. The approach outlined will then fail.<p>Were I a particularly evil warden, I could meticulously place all the boxes in the same such "jumble" after each prisoner left. One of the prisoners would certainly derive a different ordering of the boxes than one of the other prisoners. The approach might still have a better than random chance of succeeding, but it would be lower than that outlined in the article, since there are now two (or more) chances for a cycle of length greater than 50.
评论 #1657040 未加载
评论 #1654225 未加载
alphaBetaGamma超过 14 年前
For the people who would go for an analytical solution rather then monte-carlo: for a large number of prisoners the probability that they all find their numbers tends to 1 - ln(2) ~= 0.3069
评论 #1653257 未加载
Robin_Message超过 14 年前
I'm not seeing any obvious trick here. Trying it with just two prisoners, two boxes and one look, I can't see a way to do better than chance. I'm just wondering if it's something like the two envelopes problem, where you can on average do better by switching based on a monotonic function of the amount in the first envelope. Perhaps there is a way of picking the boxes based on your number that does better than average, even if its just a little bit. Any hints?
评论 #1652496 未加载
评论 #1652325 未加载
评论 #1652421 未加载
D-Coder超过 14 年前
So the key idea is, if you get arrested, take a mathematician with you...