Tuesday, March 1, 2011

Bad King & Prisoners

A bad king has a cellar of 1000 bottles of delightful and very expensive
wine. A neighboring queen plots to kill the bad king and sends a servant to
poison the wine. (un)fortunately the bad king’s guards catch the servant
after he has only poisoned one bottle. Alas, the guards don’t know which
bottle but know that the poison is so strong that even if diluted 1,000,000
times it would still kill the king. furthermore, it takes one month to have
an effect. The bad king decides he will get some of the prisoners in his
vast dungeons to drink the wine. Being a clever bad king he knows he needs
to murder no more than 10 prisoners - believing he can fob off such a low
death rate - and will still be able to drink the rest of the wine at his
anniversary party in 5 weeks time.

explain how….

1 comment:

Anonymous said...

Number each bottle 1 to 1000. Now convert this number of the bottle to its binary equivalent. You will have a 10 digit number comprising of 1s and 0s.

Now, take 10 prisoners. Assign each of them a digit from 1 to 10. The prisoner n, will sip wine from every bottle whose number's binary equivalent has a 1 at nth digit. For instance, prisoner no. 3 will sip from each and every bottle whose number's binary equivalent has a 1 at third digit.

Now, after a month, the prisoners that die are those who sipped the poisoned wine. The king can now derive the exact number of the bottle. For instance, if prisoner number 3, 5, 7, 9 died, the number of bottle of poisoned wine is:
0010101010, which is binary equivalent for 170. So bottle number 170 is poisoned.

Happy birthday - long live the evil King!!

Polo