Best Coupon Solution | CodeChef Problem Solution 2022 | April Long Two
Chef is ordering food online (instead of cooking) and the bill comes out to be Rs. . Chef can use one of the following two coupons to avail a discount.
- Get percent off on the bill amount
- Get a flat discount of Rs. on the bill amount
What is the maximum discount Chef can avail?
Input Format
- The first line contains a single integer - the number of test cases. Then the test cases follow.
- The first and only line of each test case contains a single integer - the bill amount before discount.
Output Format
For each testcase, output the maximum discount Chef can avail.
Constraints
- is a multiple of .
Solution Click Below:-
Sample Input 1
3
300
1300
1000
Sample Output 1
100
130
100
Explanation
Test case 1: Using the second coupon, Chef can get a flat discount of Rs. , which is maximum.
Test case 2: Using the first coupon, Chef can get a percent discount of Rs. , which is maximum.
Test case 3: No matter which coupon Chef chooses Chef will get a discount of Rs. .
Join Now for Solution:-
Sasta Shark Tank Solution | CodeChef Problem Solution
No comments:
Post a Comment