Hello coders, today we will be solving Smallest Number of Notes CodeChef Solution whose Problem code is FLOW005.
Task
Consider a currency system in which there are notes of six denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100.
If the sum of Rs. N is input, write a program to computer smallest number of notes that will combine to give Rs. N.
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N.
Output
For each test case, display the smallest number of notes that will combine to give N, in a new line.
Constraints
- 1 <= T <= 1000
- 1 <= N <= 1000000
Example
Input:
3 1200 500 242
Output:
12 5 7
Solution - Smallest Number of Notes - CodeChef Solution
Python 3
#Solution Provided by Sloth Coders T = int(input()) a = [100, 50, 10, 5, 2, 1] for _ in range(T): n = int(input()) b = 0 for x in a: if (x <= n): b = b + (n // x ) n = n % x print(b)
Disclaimer: The above Problem (Smallest Number of Notes) is generated by CodeChef but the Solution is provided by Sloth Coders.
Happy Coding !!
A Sloth Who loves to Code
Also Read: