Today I saw an interesting thinking problem :
You let a worker work for you for seven days , Pay with a gold bar . Gold bars are divided into 7 A small piece , You can pay a dollar a day .
however , If you can only cut the gold bar twice , So how do you cut gold bars , It can meet the requirement of paying one piece to workers every day ?
It seems to be an ordinary problem , Actually, it's binary , Did you find out ?
That is to say : The first day is for the workers 1 A small piece , The next day, the workers should be accumulated 2 A small piece , On the third day, it should be accumulated to the workers 3 A small piece .... And so on . That means I cut the gold bar into 3 Share ( Two knives ), These three can be put together separately 1,2,3,4,5,6,7 Right .
The answer is divided into These three copies :
The first day : Give it to him 1 1
the second day : Give it to him 2,3, bring back 1 2
On the third day : Give it to him 1 1+2
The fourth day : Take back 1,2,3, Give it to him 4,5,6,7 4
Fifth day : Give it to him 1 1+4
Sixth days : Take back 1, Give it to him 2,3, 4,5,6,7 2+4
Seventh days : Give it to him 1 1+2+4
It's interesting ? All non-zero natural numbers in nature , It can be done by 1,2,4,8,16,32,64,128,256,512,1024.......... form
Because all those non-zero natural numbers can be converted into 2 Base number 01 In the form of ,0 Yes, No ,1 Is to take .
There is a similar question ,1000 An apple ,10 A box , this 10 You can decide how many apples there are in each box , As long as the customer reports one at random 1000 Apples within a non-zero number , You can give him some boxes, and the total number of apples in these boxes is the number reported by the customer .
10 Put two boxes separately :1,2,4,8,16,32,64,128,256,489