1. 16個人每人事先分別分配一個1-16間的不同數字
2. 每個人將其它15個人帽子上的數字之和對16取模,然後用事先分配的數字減去前麵的結果
3. 上麵的結果對16取模(1->1, -1->16-1=15),最後得到0-15間的一個數字。如果是0,則定為16。此即最後每人應猜的數字
回複:猜自己的帽子數字
所有跟帖:
•
讚!
-guest007-
♀
(28 bytes)
()
06/07/2010 postreply
10:02:44
•
Do not think it is going to work...
-innercool-
♂
(259 bytes)
()
06/07/2010 postreply
16:09:12
•
Your output is wrong
-twfx-
♂
(129 bytes)
()
06/07/2010 postreply
18:52:34
•
Sorry, you are right. And here is the proof of the correctness.
-innercool-
♂
(463 bytes)
()
06/07/2010 postreply
19:26:05