Answer to
old chestnut: measuring four liters:
First, fill the five-liter jug. Fill the three-liter jug from the
five-liter jug, leaving two liters of water in the five-liter jug.
Dump out the three-liter jug and pour the two liters of water into
it from the five-liter jug. Refill the five-liter jug, then fill
the three-liter jug from it. Since the three-liter jug already had
two liters of water, only one more is required to fill it, and
four liters are left in the five-liter jug.
A common variation of this puzzle also includes an eight-liter jug
which is initially full of water. The only difference is that this
is used as your water supply and dump; it is simply the smallest
integer size that has enough water to solve the problem and doesn't
otherwise help!