Problem Statement We all know how these magical devices work. People sit inside and count out your
Question:
Problem Statement
We all know how these magical devices work. People sit inside and count out your money and push it through the slot.
You need a job pretty bad and they are hiring! To test your skills they are going to give you a set of coins and a money amount, V, that they want. Your job is to find out the least amount of coins you can give them.
Your input is given as:
Q = number of quarters
D = number of dimes
N = number of nickels
P = number of pennies
V = target amount
Promise
V<100
Input Format
Q D N P V
Output Format
Minimum number of coins.
If you can't make change for the given number, output NO.
Sample Input
2 3 2 1 31
Sample Output
3
Explanation
You can give 31 cents in 3 coins. 1 quarter, 1 nickel, and 1 penny
Essentials of Entrepreneurship and Small Business Management
ISBN: 978-0133849622
8th edition
Authors: Norman M. Scarborough, Jeffrey R. Cornwall