Note: This problem is an easier version of the POI problem Bank Notes from 2005.
The Byteotian Bit Bank (BBB) has the largest network of cash dispensers in the whole Byteotia. The BBB have decided to improve their dispensers and have asked you for help. The legal tender in Byteotia are bank notes of denominations
Task
Write a programme that:
- reads from the standard input the description of the dispenser's notes stock and the sum to be paid off,
- determines the minimal total number of bank notes sufficient to pay the desired sum off,
- writes the result to the standard output.
Input
In the first line of the standard input the number of denominations is written
Output
The standard output should contain one integer denoting the minimal total number of bank notes sufficient to pay the sum off
Sample Input
3
2 3 5
2 2 1
10
Sample Output
3
Comments
I'm getting WA on half of the tests, and I can't figure out why. What am I missing?
Your code doesn't work because it's wrong. Try this: 2 11 2 1 6 12 Your code outputs 2.
How is this an easier version of POI - Bank Notes? I checked the constraints and they're both
. Is the data weaker?
If you read the official problem statement, you'll see that you need to reconstruct the set of bank notes needed to reach the desired sum. The DMOJ problem does not require this and consequently that makes the DMOJ problem easier.
Thanks for the explanation.
Weak testdata:
The following testcase kills my solution
Input
Output