I found this question on a website. I write it here in my own words
Wine in one of the 1000 bottles that the king would taste has been poisoned by a person under the guise of a messenger from the rival kingdom.The messenger was hanged to death. No one knew which bottle contained the poisoned wine. The king ordered n prisoners to be brought before him and they would taste the drinks , to find the bottle with the poisoned drink.
Mark the bottles with the binary equivalent of the bottle number after they are numbered in a sequence from 1 to 1000. This binary representation requires 10 digits as 2^10=1024. Take ten prisoners and assign each prisoner to each position of the binary representation from 2^0 to 2^9
Prisoner at 2^0 position has to taste the drinks from bottles with 1 in the 2^0 position of their binary representation. That is 1,3,5,..999.After this process of tasting wine, The number of the bottle with poisoned drink can be arrived at , by getting to the number represented by the positions where there are dead prisoners after the tasting process. For example , if the prisoners at position 2^0,2^7,2^8 are dead , then the number of the bottle is 1+128+256=385
I didn't solve it , I made up the solution after checking somany solutions for this problem on the forum.
No comments:
Post a Comment