[Solution] Best Coupon solution codechef

Best Coupon solution codechef – 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.

[Solution] Best Coupon solution codechef

  • Get 1010 percent off on the bill amount
  • Get a flat discount of Rs. 100100 on the bill amount

What is the maximum discount Chef can avail?

Input Format

  • The first line contains a single integer TT – the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains a single integer XX – the bill amount before discount.

Output Format

For each testcase, output the maximum discount Chef can avail.

[Solution] Best Coupon solution codechef

  • 1T1001≤T≤100
  • 100X10000100≤X≤10000
  • XX is a multiple of 100100.

Sample Input 1 


Sample Output 1 


Best Coupon solution Explanation

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.

For Solution

Click here

Leave a Comment