In the movie Die Hard: With a Vengeance, in one of the action scenes, the characters Mc Clane and Carver were caught in a breathtaking scenario where they need to keep a bomb from exploding, and the only way to prevent explosion is to put exactly four gallons of water on a scale. How would they do it if they only have a five - gallon and a three gallon jug?
- Fill the 5-gallon jug all the way.
- Pour water into the 3 gallon jug until it is full.
- Now you have 2 gallons in the 5-gallon jug and a full 3 gallons in the 3-gallon jug.
- Empty the 3-gallon jug.
- Pour the 2 gallons of water still in the 5-gallon jug into the 3-gallon jug.
- Now the 3-gallon jug has 2 gallons of water in it, and 1 gallon of empty space.
- Fill up the 5 gallon jug all the way, and then pour water out of the 5-gallon jug into the 3-gallon jug until the 3-gallon jug is full.
- This leaves exactly 4 gallons in the 5-gallon jug.