permutations based problem
I was given a problem at school...it is...
You are given a limited number of coins of various denominations, and a certain amount. You are to compuate how many ways there are 2 pick the coins to add up 2 that amount. For e.g., given 12 coins of 1-cent value, 2 coins of 5-cent value and 3 coins of 10-cent value, and an amount of 15 cents, there are 4 combinations:
- 2 5-cent coins and 5 1-cent coins
- 1 5-cent coins and 10 1-cent coins
- 1 10-cent coin and 1 5-cent coins
- 1 10-cent coin and 5 1-cent coins
The answer (output) should therefore be 4.
The input will b read from a text file.
first line of input file = no. of different coin denominations.
second line = total amount to b made up
The remaining lines of the input file each consist of a pair of +ve integers representing a coin denomination followed by the no. of coins of the denomination avail. All nos. r in the range [1,100]