1000 barrels of wine to find a bucket of poison algorithm

Source: Internet
Author: User

Topic:

There are 1000 barrels of wine, of which 1 barrels are poisonous. And once eaten, the toxicity will occur after 1 weeks. Now we use small mice to do the experiment, in 1 weeks to find the barrel of poison, ask the minimum number of mice, how to detect (the less the use of mice the better, note that the toxicity of 1 weeks before the seizure, and a week after the results must be, so time is tight)

Ideas:

Why need mice to do experiments, obviously according to the Rat's life and death to determine the toxicity of alcohol, each mouse only 2 states, dead and alive, n mouse is this n dead or alive state, should be sensitive to the binary system, vaguely to perceive 1000 this number and n relationship, 2^n can express how much information? 2^10=1024, think of here we can try to use 10 mice to do some experiments.

Steps:

1000 barrels of wine in 10-bit binary number, from 0000000001 to 1111101000, from the 1000 binary number of the search for poison, the poison must also be a combination of 0 and 1, so the question into how to figure out how each of this combination is, We first think about how to get the first (right to left) is 0 or 1, the conclusion is as long as all the first is 1 of the wine to a mouse to drink, if the mouse eventually died, the poison must be the first bit 1, if the mouse is still alive, The first place of the poisoned wine must be 0. And so on, we use 10 mice to determine how much each of the poisoned poison is. In order to get the poison of the binary number, converted into 10 binary is only the first few barrels.

Reprinted from: http://site.douban.com/196781/widget/forum/12602268/discussion/51922413/

1000 barrels of wine to find a bucket of poison algorithm

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.