One Classic questions:
You let the workers work for you for 7 days, the return of the worker is a gold bar. Gold bars are divided into 7 connected segments, and you have to give them a piece of gold at the end of the day, and if you only have to break the gold bars two times, how do you pay your workers?
Second, the idea:
1. Gold bars can be changed, such as the workers have a piece of gold bars, pay the day can be paid by 2 paragraph to change workers, can not say that the workers get gold bars immediately took to spend, then no play
2. Gold bars are only allowed to break 2 times, that is to say, only 3 pieces of gold bar
3. Because workers receive daily wages are increasing, that is to say workers will get 1, 2, 3 ... 7 Pieces of gold bar
4. Therefore, this problem can be translated into: How to combine 3 numbers, you can get 1, 2, 3 ... 7 and these 3 numbers any one of which may be here on a certain day, or where the worker is, if we use 1 to indicate that a certain number is in my place, with 0 means not here, according to mathematical logic, this is exactly the problem of a binary number expression:
These 3 numbers are:
1 1 1
We found that the 3-bit binary can express the number is 0 ~ 111, that is, 0 ~ 7, just meet the requirements of the topic, then the simple, 3-bit binary is the length of a piece of gold bar, the bit is 1, that this section of gold bars in my place, for 0 is paid to the workers.
That 3 bits corresponds to the binary number is: 1, 2, 4
The payment method is just a truth-table:
Day One: 110, give the workers 1 pieces of gold bars
Day two: 101, give the workers 2 pieces of gold bars, take back 1 pieces of gold bars
Day three: 100, 1 and 2 bars are given to the workers
Fourth day: 011, give workers 4 pieces of gold bars, take back 1 paragraphs and 2 sections of gold bars
Fifth day: 010, give the worker 1 pieces of gold bar
Sixth day: 001, give workers 2 pieces of gold bars, take back 1 pieces of gold bars
Day seventh: 000, gold bars are given to workers.
Third, expansion
After figuring out the nature of the problem, we extend it further, such as adding a bit, will become 1111, can express 0~15, then the topic can also be changed for a worker for you to work for 15 days, gold bars can only be divided into 4 paragraphs, ask how to divide? If you look at the above ideas of friends, I believe that should be able to answer it soon.
Split gold bars