• 欢迎光临~

MathProblem 23 Fork in the road problem

开发技术 开发技术 2022-08-04 次浏览

You are traveling down a path and come to a fork in the road. A sign lays fallen at the path indicating that one path leads to a village where everyone tells the truth and the other to a village where everyone tells lies. The sign has been knocked down so you do not know which path leads to which village. Then someone from one of the villages (you don't know which one) comes down the path from which you came. You may ask him one question to determine which path goes to which village. What question do you ask?

Solution

也是很经典的问题。我们可以问 "你是来自另一个村庄的吗"

  • 如果是诚实的人,显然会回答 (No)
  • 如果是撒谎的人,则会回答 (Yes)

由此便可以分辨出来

程序员灯塔
转载请注明原文链接:MathProblem 23 Fork in the road problem
喜欢 (0)