The monetary system in Absurdistan is really simple and systematic. The locals only use coins. The coins come in different values.
The values used are:
1, 10, 25, 100, 1000, 2500, 10000, 100000, 250000, 1000000, ...
Formally, for each K>=0 there are coins worth 10K, and coins worth 25*100K.
You want to buy a new car. Its price is cost. Write a method that will return the smallest number of coins necessary to pay exactly the cost of the car (assuming
you have a sufficient supply of coins of each of the types you will need).
|