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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

When Is Cheryl's Birthday?

240 点作者 jonp大约 10 年前

19 条评论

gkoberger大约 10 年前
Maybe I'm missing something, but the "hard" part of this problem is figuring on the trick. Once you know that, it becomes relatively easy – and you can't use a program to figure out the trick.
评论 #9437335 未加载
评论 #9437483 未加载
评论 #9438228 未加载
评论 #9437524 未加载
ghurtado大约 10 年前
I thought this was a great puzzle when I first saw it. IMHO, it is more satisfying to &quot;think through it&quot; without paper and pencil, since it is relatively simple to resolve.<p>The Python solution proposed is really great, in that it captures both the expressive and functional spirit of the language.
评论 #9437014 未加载
vessenes大约 10 年前
This is just beautifully expressive python. I wouldn&#x27;t think of using it this way: writing<p><pre><code> return (not know(possible_dates) and all(not know(tell(Day(d))) for d in possible_dates)) </code></pre> feels almost zen to me; or at least like Mr. Norvig likes himself some lisp at times.
评论 #9437478 未加载
评论 #9437522 未加载
ibejoeb大约 10 年前
Here&#x27;s my quick solution in modern SQL. This is more expensive than it needs to be, but doing it this way lets you see the truth table by commenting out the final predicate.<p>fiddle: <a href="http:&#x2F;&#x2F;sqlfiddle.com&#x2F;#!15&#x2F;0c419&#x2F;160&#x2F;0" rel="nofollow">http:&#x2F;&#x2F;sqlfiddle.com&#x2F;#!15&#x2F;0c419&#x2F;160&#x2F;0</a><p>gist: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;ibejoeb&#x2F;df57cb34bbe609293d6e" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;ibejoeb&#x2F;df57cb34bbe609293d6e</a>
zhte415大约 10 年前
The problem with this problem, the way it was originally put, was the utterly confusing English masked into a logic problem.<p>Write your specifications clearly, and then it does not become an internationally shared &#x27;problem&#x27; to solve.<p>[I work with insanely documented specifications just like this, year after year. Not putting a problem clearly is not something to aspire to.]
评论 #9437716 未加载
评论 #9437871 未加载
tomp大约 10 年前
For the more mathematically minded readers, here&#x27;s a harder version of the problem:<p><a href="http:&#x2F;&#x2F;jdh.hamkins.org&#x2F;transfinite-epistemic-logic-puzzle-challenge&#x2F;" rel="nofollow">http:&#x2F;&#x2F;jdh.hamkins.org&#x2F;transfinite-epistemic-logic-puzzle-ch...</a>
xarien大约 10 年前
I&#x27;d have gone a different way since my setup and approach was a bit different (I took a more visual approach). While this solution is elegant, it&#x27;s also incredibly hard to do in the real world as it requires far too much knowledge to properly assign the &quot;correct&quot; definitions. It&#x27;s no different than having a perfect health heuristic land on your lap.<p>When I did this a while back, my approach was to construct a 5x4 matrix with blanks (5 unique dates x 4 unique months). This allowed the clues to cross off entire rows and or columns until only 1 pair stood standing. Personally, I find the construction of the solution much more interesting than the problem itself given how many people participated.
picardo大约 10 年前
I&#x27;d be interested in seeing a solution in Prolog.
评论 #9437047 未加载
zaroth大约 10 年前
My own contribution from last week:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9398638" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9398638</a><p><a href="http:&#x2F;&#x2F;opine.me&#x2F;discovering-a-new-fizzbuzz&#x2F;" rel="nofollow">http:&#x2F;&#x2F;opine.me&#x2F;discovering-a-new-fizzbuzz&#x2F;</a>
john_butts大约 10 年前
1. HN comment about some aspect of fizzbuzz or whatever. Not how to solve fizzbuzz or whatever; rather, some insight into how people solve problems, which is the interesting part of the question. 2. Two dozen oblivious nerds tell u how to do it in 20 characters of perl
评论 #9437827 未加载
Fando大约 10 年前
Maybe someone already mentioned this, but this problem is a simplified formulation of a famous number thoery riddle called &#x27;The Sum and Product Riddle&#x27; which is even more baffling. Here it is <a href="http:&#x2F;&#x2F;blog.computationalcomplexity.org&#x2F;2007&#x2F;01&#x2F;sum-and-product-riddle.html?m=1" rel="nofollow">http:&#x2F;&#x2F;blog.computationalcomplexity.org&#x2F;2007&#x2F;01&#x2F;sum-and-prod...</a>
janhaak大约 10 年前
This is quite disturbing for me. My Aunt&#x27;s name is Cheryl. Her husband, Bernard. Guess his brother&#x27;s name!
评论 #9438208 未加载
评论 #9437444 未加载
评论 #9437710 未加载
评论 #9437445 未加载
_asummers大约 10 年前
Where can I find more puzzles of this flavor? This generated some fun discussion on my Facebook wall.
评论 #9437321 未加载
评论 #9440558 未加载
mattbeckman大约 10 年前
Friend of mine wrote a Scala solution: <a href="http:&#x2F;&#x2F;www.agileatwork.com&#x2F;scala-solution-to-cheryls-birthday-problem&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.agileatwork.com&#x2F;scala-solution-to-cheryls-birthda...</a>
Nursie大约 10 年前
If you&#x27;re puzzling over this you&#x27;ve done it wrong.<p>There is no inference from silence. There is no humanity in such a question, there is simply the information you&#x27;re given and the application of logic to narrow down the answers. The Singaporean kids that took the exam knew this and anyone that&#x27;s ever taken a maths or logic exam should know this.<p>You don&#x27;t guess what might have happened from human behaviour because you don&#x27;t know, you don&#x27;t look for a &#x27;trick&#x27; to give away the answer, you simply use the data in the question to narrow down the possibilities until you can arrive at an answer.<p>The moment you think &quot;but what if this action could have taken place because if he knew he would have said&quot; you have failed.<p>And you probably suck at debugging.
kyberias大约 10 年前
Couldn&#x27;t resist. This is the solution ported to C#:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;kyberias&#x2F;cherylsharp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kyberias&#x2F;cherylsharp</a>
评论 #9438126 未加载
haddr大约 10 年前
still looking for solution using RDF&#x2F;OWL logical reasoning...<p>the python solution is neat, but i have a feeling that there are tools that are more native to these kind of problems than general purpose programming language.
评论 #9437173 未加载
frik大约 10 年前
Could one use Julia instead of Python?<p>&quot;iPython&quot; already supports Haskell and Julia kernels too. A iPython Javascript kernel would also make sense given its popularity and its functional inspired syntax.
评论 #9438062 未加载
andrewprock大约 10 年前
Unfortunately, there are a number of rather curious, and culturally specific, assumptions one must make about the problem.<p>The real puzzles are:<p>1. &quot;Why did Albert speak first?&quot;<p>2. &quot;Why did he speak in such cryptic language?&quot;
评论 #9437673 未加载
评论 #9437451 未加载