Tonight, I turned out an interesting question in my previous collection--the 1000-pack of apples:
Now there are 1000 apples, and 10 boxes, how to put the 1000 apples in these 10 boxes, in order to make any number (1-1000) of apples, can be given at once?
Typical binary number variants, 1000 apples, closest to 1024, converted to 2 binary, 10 bit required, then from right to left, the first bit to represent 1 apples, the second bit to represent 2 apples, the third bit to represent 4 apples,, The 10th bit bit represents 488 apples (512-24). Put these through in the same numbered box respectively. When a certain number of apples are needed, check which bits of these numbers are 1 and 1 indicate that the bit bit represents an apple and the corresponding numbered box is taken out.
There are other Bo friends that Amoy to the poison problem, similar:
There are 8 bottles of liquid, one bottle is poison, toxicity can make the mice after drinking in 20 hours killed, need a few mice to determine in 20 hours which bottle is poison?
Analysis:
To encode 8 bottles of poison:
First bottle: 000
Second bottle: 001
Third bottle: 010
Bottle IV: 011
Bottle Five: 100
Six-Ping: 101
Seventh Draw: 110
Eighth draw: 111
Just 3 little mice.
The first mouse drank the last bit of 1, that is, the 2,4,6,8 bottle.
The second mouse drank a median bit of 1, the first 3,4,7,8 bottle
The third mouse drank the first bit of 1, that is, the 5,6,7,8 bottle.
If there is no mouse death in 20, the first bottle is poisonous, otherwise:
Suppose the second and third mouse die, set the corresponding bit to 1, or 110, so the 7th bottle is poisonous.
Binary Puzzles--1000 apple questions