Binary method.

Source: Internet
Author: User

Question: there are 1000 bottles of water, one of which is toxic. Mice will die 24 hours after they taste a little poisonous water, at least how many mice should be able to identify the bottle of water from 24 hours.

 

Answer:

Use a binary algorithm.

Set the serial number of 1000 bottles of water in binary format. Pow (1024) = 1000>, so that each serial number has 10 digits.

Let the 10 mice go from 1 to 10 and let the N mice drink the water with the N number as 1,

A new ten-digit binary number is defined. The numbers of the dead mice are all 1.

For example, 1, 3, 5, 7, and 8 are dead, and the binary number of the toxic bottle is 1010101100

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.