If you ever swim or paddle upstream, you will notice two things. First, a river's speed varies a lot. Second, those variations should cause you to pull harder when you hit rapidly flowing water. If you don't, you will simply make no progress. This puzzle replaces your muscles with a motor, but still asks you to figure out how to trade off energy for time.

Here are the facts:

• You want to go 72 kilometers (km) upriver.
• The first 24 km has a downstream speed of 7 kilometers per hour (kmh).
• The next 18 km has a downstream speed of 2 kmh.
• The last 30 km has a downstream speed of 0 kmh (the river becomes a lake).

You have an electric motor with three settings that can push the boat forward at a water speed of:

• 5 kmh using 1 kilowatt (kW) of power
• 10 kmh using 3 kW
• 15 kmh using 5 kW

Recall that land speed = water speed - downstream speed.
So, for example, if your water speed upstream is 15 kmh but the river has a downstream speed of 2 kmh, then your land speed is 13 kmh.

Warm-up:
Suppose you went full speed on all legs of the voyage. How long would the journey take and how much energy would you expend?

Dennis Shasha is at the Courant Institute of Mathematical Sciences, New York University. His most recent puzzle book, Puzzles for Programmers and Pros, was published in 2007 by John Wiley and Sons/Wrox.