
withdraw
An ATM ran out of 10
dollar bills and only has 100
, 50
and 20
dollar bills. Given an amount between 40
and 1000
dollars (inclusive) and assuming that the ATM wants to use as few bills as possible, determinate the minimal number of 100
, 50
and 20
dollar bills the ATM needs to dispense (in that order).
Example:
- For
n=250,
the output should bewithdraw(n)=[2,1,0].
- For
n=260,
the output should bewithdraw(n)=[2,0,3].
Input/Output:
-
[execution time limit] 0.5 seconds
-
[input] integer N
Amount of money to withdraw. Assume that
N
is always exchangeable with[100, 50, 20]
bills -
[output] array.integer
An array of number of 100, 50 and 20 dollar bills needed to complete the withdraw (in that order)
Post Comment