5 DEATH RAT
:
Where X = Number of wine bottles
Z = Hours for poison to effect
Y = Hours to find a poisoned bottle
import math
#X wine bottles
X=1000
#Z hour time after which the poison works
Z=24
#Y hour time to find the poisoned bottle
Y=48
T = Y/Z
print ("Number of rats required to find the poisoned bottle: ", end="")
print (math.ceil(math.log(X,T+1)))
Output:
Number of rats required to find the poisoned bottle: 7
Now if X=1000
Z=1
Y=1
Then output:
Number of rats required to find the poisoned bottle: 10
Now if X=240
Z=24
Y=48
Then output:
Number of rats required to find the poisoned bottle: 5