A farmer needs 10 gallons of water. He has only four unmarked buckets, three 8 gallon and one 13 gallon bucket.
Determine how he can collect 10 gallons of water using these four unmarked buckets.
Provide the solution with minimal water wastage.
I'll assume the water comes from a tap, and wasted water is water dispensed beyond the needed 10 gallons.
Let the last bucket be the 13 gallon capacity:
0,0,0,13 <---fill 13
0,0,8,5
5,0,8,0
5,0,0,8
5,0,0,13 <--- add 5 to the 13
5,0,8,5
0,0,8,10
This wastes 8.
There may be a better solution.
|
Posted by Jer
on 2024-06-23 15:15:11 |