There were three rats, eight bottles of water, one of which was poisonous. After drinking poisonous water, the mice would die on time in a week.Find a way to determine which one is poisonous。

Number the bottle 0-7, and translate the number into a binary string, which can be represented by three binaries. Let the three mice correspond to the three binaries respectively, and then form the following crosstab:

Mouse 1 Mouse 2 Mouse 3

0 = 000

1 = 001

2 = 010

3 = 011

4 = 100

5 = 101

6 = 110

7 = 111

Where the binary digit is 1 indicates which mouse takes which bottle of medicine. Namely:

Rat 1 should drink 4,5,6,7.

Rat 2 should drink 2,3,6,7.

Rat 3 should drink 1,3,5,7.

At the end of the observation, according to the situation of mice dead, 0 means not dead, 1 means dead.

For example, the death of three mice (1, 0, 1) indicates that drug 5 is toxic. Because only in this case can mice 1 and 3 die.

Categories: Python

1 Comment

Anonymous · 2019年1月17日 at 13:04

It is simple to establish a website if you have some knowledge of linux system. There are so many instructions on the internet .

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *