Today, I spoke to others in the SL group.Algorithm, Discussed a few sub-questions, is summarized as follows:
1. Weighing sugar Problems
There are ten packs of sugar, each containing 10 candy, each containing 1 gram of weight, one of which is very special, each containing 2 grams of weight, there is an electronic scale, please check the bag of sugar only once?
First, set the serial numbers of all sugar packets from 1 to 10. Then take 1 capsule from the first day, 2 for the second, 3 for the third ...... Take 10 pills on the 10th. Then weigh X. We know that if it is normal, the weight should be 10! = 55, the result is certainly not, because there is a heavy package, so X-10! Is the result.
2. Mouse Test Problems
There are 1000 bottles of medicine, and there are 10 little mice. The medicine can be mixed. If these mice are asked to take only one medicine, which bottle will be tested to be toxic?
First, compress the 1000 bottles of Medicine from 1 to 1000, compress the 10 mice into the numbers 1-10, and then convert the numbers 1-to binary, let the mice use their own serial numbers to test the targeted medicine, that is, the first dose of the mouse on the first day of the test, and the N dose of the mouse on the second day of the test, if the mouse is located, the first part is toxic. If no part is found, the second part is toxic. In this way, we can test the bitwise Number of the toxic drug and convert it to the 10th notation to know which drug is toxic.