Four friends are gathered at a pub. They have in front of them two 8-pint trankards full of beer, and an empty 3-pint mug.
Since they are still sober, they quickly calculate that they have 16 pints for the four of them, which comes out to an even 4 pints per person.
Can they divide the beer equally with the containers they have available?
Nick was definitely on the right track. I did a small amount of programming to find the shortest possible solution. In the following table, the first two numbers are the quantities remaining in the two tankards, next is the quantity remaining in the mug, then the quantity drunk by each of the four drunkards:
8 8 0 0 0 0 0 Initial configuration
5 8 3 0 0 0 0 Fill mug from T1
5 8 0 3 0 0 0 Person 1 drinks mug
2 8 3 3 0 0 0 Fill mug from T1
0 8 3 3 2 0 0 Person 2 drinks T1
3 8 0 3 2 0 0 Empty mug into T1
3 5 3 3 2 0 0 Fill mug from T2
6 5 0 3 2 0 0 Empty mug into T1
6 2 3 3 2 0 0 Fill mug from T2
8 2 1 3 2 0 0 Fill T1 from mug
8 2 0 4 2 0 0 Person 1 drinks mug
5 2 3 4 2 0 0 Fill mug from T1
0 7 3 4 2 0 0 Empty T1 into T2
3 7 0 4 2 0 0 Empty mug into T1
3 4 3 4 2 0 0 Fill mug from T2
6 4 0 4 2 0 0 Empty mug into T1
6 1 3 4 2 0 0 Fill mug from T2
8 1 1 4 2 0 0 Fill T1 from mug
8 0 1 4 2 1 0 Person 1 drinks T2
8 0 0 4 2 1 1 Person 4 drinks mug
5 0 3 4 2 1 1 Fill mug from T1
5 0 0 4 2 4 1 Person 3 drinks mug
2 0 3 4 2 4 1 Fill mug from T1
0 0 3 4 4 4 1 Person 2 drinks T1
0 0 0 4 4 4 4 Person 4 drinks mug
Anyone who can devise and follow these instructions while drinking a half-gallon a beer is a better man than I. :-)
|
Posted by Jim Lyon
on 2002-06-13 08:39:43 |