返回题库

毒酒桶 II

Poisoned Kegs II

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

题目详情

国王有 10 名仆人试酒,nn 桶酒中恰好 1 桶有毒。若喝到毒酒,1 个月后死亡;否则存活。

仆人只同意参与 1 个月。

问:最大 nn 是多少,才能保证国王一定能找出毒桶?

A King has 1010 servants who risk their lives to test which of the nn kegs of wine is poisoned. Exactly one keg is poisoned, and if a servant drinks from it, they will die in 11 month, otherwise, they survive. The servants agree to participate for only 11 month. What is the maximum value of nn such that the king can always identify the poisoned keg?

解析

10 名仆人对应 10 位二进制信息,可区分 2102^{10} 种死亡模式。

把桶编号为 0..n1n-1 的二进制;第 kk 位为 1 的桶由第 kk 名仆人去尝。

1 个月后死亡模式唯一对应桶编号。

因此最大 n=210=1024n=2^{10}=1024


Original Explanation

The kegs can be labeled in binary from 00 to n1n-1, and the servants are labeled from 00 to 99. With 1010 servants, we can represent up to 1010 binary digits. Each keg label ii can be written as i=a0i+a1i21++a9i29i = a_{0i} + a_{1i} \cdot 2^1 + \dots + a_{9i} \cdot 2^9, where a0i,a1i,,a9i=0a_{0i}, a_{1i}, \dots, a_{9i} = 0 or 11. We give wine from keg ii to all servants whose indices match the binary sequence:

Si={0k9:aki=1}S_i = \{0 \leq k \leq 9 : a_{ki} = 1\}

For example, if i=17=00000100012i = 17 = 0000010001_2, servants 00 and 44 receive wine from keg 1717. After a month, the pattern of servants who die reveals which keg is poisoned. If servants 00 and 44 die, then keg 1717 is poisoned. This creates a one-to-one mapping between the kegs and binary sequences of length 1010. Thus, the maximum nn is 210=10242^{10} = 1024 kegs. We can't test more than this, as there are only 2102^{10} subsets of servants, which wouldn't allow unique identification if n>1024n > 1024.