To find the minimum number of measurements required to get exactly 298 litres, we can use a combination of drawing water from the tank (adding to our container) and pouring water back into the tank (subtracting from our container).
Approach 1: Only Adding Water
If we only draw water, we would use the greedy approach (using the largest possible cylinders first):
- 2 times 100 litres = 200 litres
- 3 times 25 litres = 75 litres
- 3 times 6 litres = 18 litres
- 5 times 1 litre = 5 litres
Total volume = 200+75+18+5=298 litres.
Total measurements = 2+3+3+5=13 times.
Approach 2: Adding and Subtracting Water (Optimal)
To minimize the number of measurements, we can overshoot the target volume and then remove the excess water by pouring it back into the tank.
- We can draw 100 litres 3 times: 3×100=300 litres. (This takes 3 measurements)
- We have an excess of 2 litres (300−298=2).
- We can remove this excess by using the 1-litre cylinder to pour water back into the tank 2 times: 2×1=2 litres. (This takes 2 measurements)
Total volume = 300−2=298 litres.
Total measurements = 3 (drawing) +2 (pouring back) = 5 times.
Can we do it in 4 measurements?
To get close to 298 with 4 measurements, we must use the 100-litre cylinder 3 times (300 litres). We would then have only 1 measurement left to subtract the excess.
The closest volumes we could achieve are:
- 3×100−1×1=299 litres
- 3×100−1×6=294 litres
Since neither gives exactly 298 litres, 4 measurements are not enough.
Thus, the minimum number of times one needs to measure is 5.