Quote:
Originally Posted by kopchoir i have 3 tankards
the first tankard holds 16 gallons and is full of ale
the second tankard holds 9 gallons and is empty
the 3rd tankard holds 7 gallons and is empty
i need to get the 16 gallon tankard and the 9 gallon tankard holding exactly 8 gallons
cheers
simon
has had me stumped for around 45 mins now  |
OK, this is a bit long winded, and I am sure it can be done in a shorter way, but....
Pour the 16 into the 7 (leaving 9 - 0 - 7)
Pour the 7 into the 9 (leaving 9 - 7 - 0)
Pour the 9 into the 7 (leavng 2 - 7 - 7)
Pour the 7 into the 9 (leaving 2 - 9 - 5)
Pour the 9 into the 16 (leaving 11 - 0 -5)
Pour the 7 into the 9 (leaving 11 - 5 - 0)
Pour the 16 into the 7 (leaving 4 - 5 - 7)
Pour the 7 into the 9 (leaving 4 - 9 - 3)
Pour the 9 into the 16 (leaving 13 - 0 - 3)
Pour the 7 into the 9 (leaving 13 - 3 - 0)
Pour the 16 into the 7 (leaving 6 - 3 - 7)
Pour the 7 into the 9 (leaving 6 - 9 - 1)
Pour the 9 into the 16 (leaving 15 - 0 - 1)
Pour the 7 into the 9 (leaving 15 - 1 - 0)
Pour the 16 into the 7 (leaving 8 - 1 - 7)
Pour the 7 into the 9 (leaving 8 - 8 - 0)
And there you go!
EDIT: Just saw your solution! 2 steps shorter than mine.

Oh well. Can I have the last 25 minutes of my life back please?