Two containers: one holds liters and the other holds
The challenge: measure a specific quantity of liquid using only a sequence of actions chosen from the legal moves below.
We can use these moves to measure amounts of water that are different from the exact measurements on the bottles. For example, if we fill the -liter container and pour it into the -liter container until it is full, we can be certain that we have liters remaining in the larger bottle.
We can also combine multiple steps to find even more measurements. For example, we can measure out liter by doing the following:
- Fill the -liter bottle.
- Empty the -liter bottle into the -liter bottle.
- Refill the -liter bottle.
- Pour the -liter bottle into the -liter bottle until the larger bottle is full.
This leaves us with exactly liter left in the smaller bottle.