The front-end time goes out for an interview and has an interesting question:
For each bucket of 9l and 11l, there is an unlimited amount of water. How can we get 10l of water?
If you get such a question, let's talk about it first:
1) first fill the 11l bucket with full water and then fill the 9l bucket with the water in the 11l bucket, then we will get 2L of water in the 11l bucket;
2) then, empty the 9l bucket; pour the 2L water in the 11l bucket into the 9l bucket;
3) Fill the 11l bucket with full water, and then fill the 9l bucket with the water in the 11l bucket (as long as 7l, because 2L already exists in step 2 ), then we can get the 4l (11-7) water in the 11l bucket;
4) Empty 9l bucket; pour 4l water from 11l bucket to 9l bucket;
5) Fill the 11l bucket with full water, and then fill the 9l bucket with the water in the 11l bucket (as long as 5l, because 4l already exists in step 4 ), the 6l (11-5) Water is in the 11l bucket;
6) Empty the 9l bucket; pour the 6l water in the 11l bucket to 9l bucket;
7) Fill the 11l bucket with full water, and then fill the 9l bucket with the water in the 11l bucket (as long as 3l, because 6l already exists in step 4 ), the 8l (11-3) Water is in the 11l bucket;
8) Empty the 9l bucket; pour the 8l water in the 11l bucket to 9l bucket;
9) Fill the 11l bucket with full water, and then fill the 9l bucket with the water in the 11l bucket (as long as 1l, because 8l already exists in step 4 ), then we can get 10 L (11-1) of water in the 11l bucket; --- over
Because 10, 9, and 9l buckets cannot store so much water.
Extension 1:
How many liters of water does this method produce? How much is wasted?
Two problems are analyzed together:
11l bucket filled 5 times: 11*5 = 55; --- and 9l bucket water comes from 11l bucket, so a total of 55l water is required.
9l bucket emptying 4 times: 9*4 = 36; --- this is a waste of water, because all the dumped water comes from 9l Bucket
The final water: 10l in 11l bucket has a bucket full of 9l water, that is, 10 + 9 = 19
19 + 36 = 55: the calculation is correct.
Extension 2:
There is an infinite amount of water in each NL and N + 2L bucket. How can we get the water (n + 1) L? (N> 0, n is an odd number)
(N + 2) l bucket filled (n + 2)/2 times: (n + 2) [(n + 2)/2] = m (note: [] The identifier is an integer, the same below, because N is an odd number, so n + 2 is also an odd number, so [(n + 2)/2] = (n + 2-1) /2 = (n + 1)/2 );
--- And the NL bucket water comes from (n + 2) l bucket, so a total of ml of water is required. (M = (n + 2) (n + 1)/2 = N * n/2 + 3 * n/2 + 1)
NL bucket emptying [(n + 2)/2]-1 (I .e. (N-1)/2) times: N * (N-1)/2 = P; --- this is a waste of water, because all the dumped water comes from the NL bucket (P = N * n/2-N/2)
The final obtained water: (n + 2) L (n + 1) l there is a bucket full of NL water, that is, N + n + 1 = 2n + 1
The 2n + 1 + P = m calculation is correct.