minimum-coins

Ram has to pay Shyam R rupees and but the coins which he has got is of limited denomination .Assuming he has a limited knowledge of the mathematics and has unlimited number of coins of each denomination.Write a code to help Ram to pay the money using minimum number of coins .Suppose Ram has coins of {1,2} denomination then the best way to pay 8 rupees is 2+2+2+2 that means using 4 coins.
Input:
Money to be paid
{array containing denominations available}
Output 
Coins corresponding to each denomination and number of coins needed(ascending denomination)
or print ERROR in other cases

SAMPLE INPUT
24
{1,7,3}

SAMPLE OUTPUT
Rupee 1 coin 0
Rupee 3 coin 1
Rupee 7 coin 3

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY
Tags: Mathematics


Solutions: