
ZOJ Problem Set  2256
The cost of taking a taxi in Hangzhou is not a constant for each kilometer you travel: the first 4 kilometers costs 10 yuan (yuan is the monetary unit in China), even if you don't finish it; the next 4 kilometers costs 2 yuan each and the price for the rest of the trip is 2.4 yuan per kilometer; the last part of the trip is regarded as 1 kilometer even if it's shorter. A traveller may reduce the cost by reseting the meter at the middle of the trip if used wisely. For example, if the trip is 16 kilometers, he should cut it into two parts with the same length, each half will cost 18 yuan, with an overall cost of 36, less than the original price of 37.2. Now, given the length of the trip, find the minimum cost.
Author: PAN, Minghao Source: ZOJ Monthly, November 2004 