Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef is ordering food online (instead of cooking) and the bill comes out to be Rs. XX. Chef can use one of the following two coupons to avail a discount.
What is the maximum discount Chef can avail?
For each testcase, output the maximum discount Chef can avail.
Input: 3
300
1300
1000
Output: 100
130
100
Test case 1: Using the second coupon, Chef can get a flat discount of Rs. 100100, which is maximum.
Test case 2: Using the first coupon, Chef can get a 1010 percent discount of Rs. 130130, which is maximum.
Test case 3: No matter which coupon Chef chooses Chef will get a discount of Rs. 100100.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();
while(t-->0){
int x=sc.nextInt();
int y=x/10;
if(y>100){
System.out.println(y);
}
else{
System.out.println("100");
}
}
}
}
# cook your dish here
for i in range(int(input())):
a=int(input())
print(max((int(a*0.1)),100))
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int a;
cin>>a;
if(a<1000){
cout<<"100"<<endl;
}
else{
cout<<a/10<<endl;
}
}
return 0;
}
In our experience, we suggest you solve this Best Coupon 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 Best Coupon CodeChef Solution
I hope this Best Coupon 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 >>