Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
There are only 2 type of denominations in Chefland:
Chef wants to pay his friend exactly X rupees. What is the minimum number of coins Chef needs to pay exactly X rupees?
For each test case, output on a new line the minimum number of coins Chef needs to pay exactly X rupees.
Input: 4
53
100
9
11
Output: 3
0
9
1
Test case 1: Chef can use 5 notes and 3 coins in the optimal case.
Test case 2: Chef can use 10 notes and 0 coins in the optimal case.
Test case 3: Chef can only use 9 coins.
Test case 4: Chef can use 1 note and 1 coin in the optimal case.
#include <iostream>
using namespace std;
int main() {
int t,x;
cin>>t;
while(t--){
cin>>x;
if(x<10)
cout<<x<<endl;
else
cout<<x%10<<endl;
}
return 0;
}
t = int(input())
for _ in range(t):
a = int(input())
print(a%10)
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner s=new Scanner(System.in);
int T=s.nextInt();
while(T-->0)
{
int x=s.nextInt();
System.out.println(x%10);
}
}
}
In our experience, we suggest you solve this Minimum Coins CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Minimum Coins CodeChef Solution
I hope this Minimum Coins CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>