返回题库

通往 Offer 之门

Door to Offer

专题
Brainteaser / 脑筋急转弯
难度
L3

题目详情

你面前有两扇门。一扇通向你的工作 offer,另一扇通向出口。每扇门前各站着一名守卫。一名守卫永远说谎,另一名永远说真话。你只能向其中一名守卫问一个是或否问题。假设你确实想拿到这份 offer,你会问什么?

You are facing two doors. One leads to your job offer and the other leads to exit. In front of either door is a guard. One guard always tells lies and the other always tells the truth. You can only ask one guard one yes/no question. Assuming you do want to get the job offer, what question will you ask?

解析

可以问任意一名守卫:

“如果我问另一名守卫,你这扇门是否通向 offer,他会回答‘是’吗?”

判断规则:

  • 如果他回答“是”,就走另一扇门;
  • 如果他回答“否”,就走这名守卫面前的门。

原因是无论你问到的是说真话的还是说谎的,回答都会把正确的门“反着说”出来,因此只要按上面的规则反向选择,就一定能走到通向 offer 的门。


Original Explanation

One popular answer is to ask one guard: "Would the other guard say that you are guarding the door to the offer?" If he answers yes, choose the other door; if he answers no, choose the door this guard is standing in front of.

There are two possible scenarios:

  1. Truth teller guards the door to offer; Liar guards the door to exit.
  2. Truth teller guards the door to exit; Liar guards the door to offer.

If we ask a guard a direct question such as "Are you guarding the door to the offer?" For scenario I, both guards will answer yes; for scenario 2, both guards will answer no. So a direct question does not help us solve the problem.

The key is to involve both guards in the questions as the popular answer does. For scenario 1, if we happen to choose the truth teller, he will answer no since the liar will say no; if we happen to choose the liar guard, he will answer yes since the truth teller will say no. For scenario 2, if we happen to choose the truth teller, he will answer yes since the liar will say yes; if we happen to choose the liar guard, he will answer no since the truth teller with say yes.

So for both scenarios, if the answer is no, we choose that door; if the answer is yes, we choose the other door.