返回题库

国王蛋糕

King Cake

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

题目详情

一位国王想要举办一个节日,邀请 1000 名宾客。按照传统,每位客人都会给国王带来一个迷你蛋糕。然而,国王收到消息称,一位客人给了国王一块有毒的蛋糕。不幸的是,国王不知道哪块蛋糕是有毒的。

国王计划处决 10 名囚犯,并决定用他们来尝尝哪种蛋糕含有毒药。服下毒药后,囚犯不会产生任何影响,直到 24 小时后,受感染的囚犯突然死亡。国王需要在明天之前确定哪个蛋糕有毒,并且有时间进行一轮测试。国王如何管理这些蛋糕,才能保证在 24 小时内知道哪块蛋糕中毒了?

A king wants to hold a festival, for which he is inviting 1000 guests. As a tradition, each guest will bring the king one mini cake. However, news reaches the king that one of the guests has given the king a poisoned cake. Unfortunately, the king has no idea which cake is the poisoned one.

The king has 10 prisoners he plans to execute and decides to use them to taste test which cake contains the poison. The poison, when consumed, has no effect on the prisoner until 24 hours later when the infected prisoner suddenly dies. The king needs to determine which cake is poisonous by tomorrow, and has time for one round of testing. How can the king administer the cakes so that in 24 hours he is guaranteed to know which cake is poisoned?

解析

用十进制数和二进制数标记每个蛋糕,并让囚犯根据其二进制代码吃每个蛋糕。例如,如果蛋糕标记为 0011010101,则让囚犯 C、D、F、H 和 J 吃它。如果蛋糕有毒,那么吃了蛋糕的囚犯会在24小时后死亡,国王就会知道那是哪一个瓶子。


Original Explanation

Label each cake with both its decimal number and binary equivalent, and have the prisoners eat from each cake according to its binary code. For example, if a cake is labeled 0011010101, then have prisoners C, D, F, H, and J eat from it. If the cake is poisoned, then the prisoners who ate from it will die 24 hours later, and the king will know which bottle it was.