White mouse test poison, at least how much to test the results

Source: Internet
Author: User
There are 1000 barrels of wine, of which 1 barrels are poisonous. And once eaten, the toxicity will occur after 1 weeks. Now let's do it with a little mouse.

Experiment, in 1 weeks to find out the barrel of poison, ask the minimum number of mice needed.

A mouse drinks after two different states: Dead (0) and Live (1).
So 10 mice can represent 2 of the 10-time state (1024). 2^0 represents 2 of the 0-time side. 2^8 represents 2 of the 8-time side.
There were 10 mice numbered 2^0,2^1, 2^2, 2^3, 2^4, 2^5, 2^6, 2^7, 2^8, 2^9. There are 1000 barrels of wine numbered .... Until 1000.

The number of any barrel of wine can be decomposed into the form of the sum of the power exponent of 2, and only. For example: nineth barrels of wine 9 = 2^0 + 2^3
(then we let the two mice numbered 2^0 and 2^3 to drink the barrel of wine) and finally just see which mice were dead and know which barrel was in trouble. (As long as the dead mouse number is added to the number of the cask)

10 mice were lined up in sequence, and each barrel was converted into binary according to the number, giving the mouse a 1 of the corresponding position to drink. Finally, according to the Dead Mouse is which several, then into the binary system, and then turn into a decimal is the first few barrels of wine.

For example: 70th barrels of wine, 70 converted into binary is 0001000110, then give 第四、八、九只 mice drink. If the last dead 第三、七、八只 mouse, then is 0010001100, converted to decimal is 140, that is, 140 barrels of wine poisonous.

(PS: In fact, similar to the same kind of topic, there are many barrels of distilled water, one of which is poisonous, then use 5 mice can identify up to how many bottles of distilled water, the answer is 31 bottles, because the 5-bit maximum can represent 31. The principle is similar to this)

White mouse test poison, at least how much to test the results

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.