What is the value of pairs after the following assignment?
pairs = [ (x,y) for x in range(5,1,-1) for y in range(4,1,-1) if (x+y)%3 == 0 ]Denominations - 3
Write a program to find the minimum number of notes required for the amount M. Available note denominations are 500, 50, 10, 1.
Input
The first line is a single integer M.
Output
Print M in denominaitons.
Explanation
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
Sample Input 1
1543
Sample Output 1
500: 3 50: 0 10: 4 1: 3
Sample Input 2
1259
Sample Output 2
500: 2 50: 5 10: 0 1: 9
Denominations - 4
Write a program to find the minimum number of notes required for the amount M. Available note denominations are 2000, 500, 200, 50, 20, 5, 2, 1.Input
The first line is a single integer M.
Output
Print M in denominations.
Explanation
Given
M = 2257 Then 2257 can be written as
2000 * 1 + 500 * 0 + 200 * 1 + 50 * 1 + 20 * 0 + 5 * 1 + 2 * 1 + 1 * 0So the output should be
2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0.
Sample Input 1
2257
Sample Output 1
2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0
Sample Input 2
2345
Sample Output 2
2000:1 500:0 200:1 50:2 20:2 5:1 2:0 1:0