Solve for these situations: a.You have 30 barrels of wine, one of which has been
ID: 3194934 • Letter: S
Question
Solve for these situations:
a.You have 30 barrels of wine, one of which has been poisoned. You have 5 slaves whom you are willing to sacrifice in order to determine which barrel contains the poisoned wine. How do you achieve this?
b. You have 1000 barrels of wine, one of which has been poisoned. After drinking the poisoned wine, one dies within 24 hours. You have 5 slaves whom you are willing to sacrifice in order to determine which barrel contains the poisoned wine. How do you achieve this in 3 days?
Similar Solution here: https://www.geeksforgeeks.org/puzzle-5-finding-the-poisoned-wine/. Please show all work and explain
Explanation / Answer
we can use n slaves / rats /object to test upto 2^n barrels of wine./poisonous items.
this is based on representation of any number in different base.
here base will be 2 .
hence 0 and 1 will be digits.
we can represent upto 31 by digits using 0 and 1
example 10110 , etc
first digit corresponds to first slave ,
2nd digit corrsponds to 2nd and so on
each barrel is numbered from 1 to 30 and corresponding to each digit at its different place , following will be done:-
0 depicts that bottle was not fed to that slave
1 depicts that bottle was fed to that slave
hence
10110 = 16 + 4 +2 = 22
10110 means bottle 22 is fed to slave 1 , 3 and 4 , but not to 2 and 5
now we will wait for death of different death of slaves ,
a unique combination of slaves will die telling us which bottle is poisoned.
if slave i dies ,digit at ith place will be 1 else 0
for example
If slave numbers 2 and 4 die , but 1,3 and 5 does not die
01010 = 8 + 4 = 12
this mean barrel 12 was poisonous.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.