Denominations - 3
Write a program to find the minimum number of notes required for the amount
The first line is a single integer
Given
M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be
500: 3 50: 0 10: 4 1: 3
n = int(input())
n_500 = n // 500
n %= 500
n_50 = n // 50
n %= 50
n_10 = n // 10
n %= 10
print('500: {0}\n50: {1}\n10:{2}\n1: {3}'.format(n_500,n_50,n_10,n))
Comments
Leave a comment