All submissions for this problem are available.
The King of Holumba Island has devised a coin system for exchange of goods and trade among the people. There are 4 coins provided by the king. The coins are of the value Rs. 1, Rs. 2, Rs. 3, and Rs. 5. Devise a coin calculator which finds out the number of coins required to compute an amount of money, such that a least amount of coins are needed. When there is more than one solution, the output should be such that the coins with more value are given preference.
The amount to compute (say i)
The output should be in 4 lines ,as shown below(refer example if any confusion) :
- a = number of Rs. 5 coins
- b = number of Rs. 3 coins
- c = number of Rs. 2 coins
- d = number of Rs. 1 coins
24 = (4 X Rs. 5) + (1 X Rs. 3) + (0 X Rs. 2) + (1 X Rs. 1)
|Time Limit:||0.210145 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.