★ [推理] 中級-猜撲克牌(z)P先生、Q先生都具有足夠的推理能力。
這天,他們正在接受推理面試。
他們知道桌子的抽屜裏有如下16張撲克牌:
紅桃A、Q、4
黑桃J、8、4、2、7、3
梅花K、Q、5、4、6
方塊A、5
約翰教授從這16張牌中挑出一張牌來,
並把這張牌的點數告訴P先生,
把這張牌的花色告訴Q
先生。
這時,約翰教授問P先生和Q先生:
你們能從已知的點數或花色中推知這張牌是什麼牌嗎?
P先生:"我不知道這張牌。"
Q先生:"我知道你不知道這張牌。"
P先生:"現在我知道這張牌了。"
Q先生:"我也知道了。
在一旁的你知道這張牌是什麼牌嗎?
Simple elimination:
紅桃A、Q、4
黑桃J、8、4、2、7、3
梅花K、Q、5、4、6
方塊A、5
Init: {HA, HQ, H4, SJ, S8, S4, S2, S7, S3, CK, CQ, C5, C5, C6, DA, D5}
1. P: 我不知道这张牌。
S2, S3, C6, S7, S8, SJ, CK are eliminated. (If not, P will know it as there numbers have single appearance)
Pool:
{HA, HQ, H4, S4, CQ, C4, DA, D5}
2. Q:我知道你不知道着张牌。
S4, CQ, C4 are eliminated (If not, Q will not know P don't know it as only Spade and Club have those who have single appearance)
Pool:
{HA, HQ, H4, DA, D5}
3. P:现在我知道这张牌了。
HA, DA are eliminiated (If not, P will not able to know it as A have appearance for both Heart and Diamond)
Pool: {HQ, H4, D5}
4. Q:我也知道了。
HQ, H4 are eliminated (If not, Q will not know it as only diamond have only one appearance now.)
Answer: Diamond 5
黑桃J、8、4、2、7、3
梅花K、Q、5、4、6
方塊A、5
Init: {HA, HQ, H4, SJ, S8, S4, S2, S7, S3, CK, CQ, C5, C5, C6, DA, D5}
1. P: 我不知道这张牌。
S2, S3, C6, S7, S8, SJ, CK are eliminated. (If not, P will know it as there numbers have single appearance)
Pool:
{HA, HQ, H4, S4, CQ, C4, DA, D5}
2. Q:我知道你不知道着张牌。
S4, CQ, C4 are eliminated (If not, Q will not know P don't know it as only Spade and Club have those who have single appearance)
Pool:
{HA, HQ, H4, DA, D5}
3. P:现在我知道这张牌了。
HA, DA are eliminiated (If not, P will not able to know it as A have appearance for both Heart and Diamond)
Pool: {HQ, H4, D5}
4. Q:我也知道了。
HQ, H4 are eliminated (If not, Q will not know it as only diamond have only one appearance now.)
Answer: Diamond 5
Yeah!