GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Thursday 26 May 2022

[Solution] Take discount or Not CodeChef Solution | CodeChef Problem Solution 2022

There are N items in a shop. You know that the price of the i-th item is Ai. Chef wants to buy all the N items.

There is also a discount coupon that costs X rupees and reduces the cost of every item by Y rupees. If the price of an item was initially Y, it becomes free, i.e, costs 0.

Determine whether Chef should buy the discount coupon or not. Chef will buy the discount coupon if and only if the total price he pays after buying the discount 

Solution Click Below:-  CLICK HERE

coupon is strictly less than the price he pays without buying the discount coupon.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases. The description of the test cases follows.
  • Each test case consists of two lines of input.
    • The first line of the test case contains three space-separated integers — NX, and Y.
    • The second line contains N space-separated integers — A1,A2,,AN.

Output Format

  • For each test case, output COUPON if Chef should buy the discount coupon, and NO COUPON otherwise.

Each letter of the output may be printed in either lowercase or uppercase. For example, the strings couponCouPoN, and COUPON will all be treated as equivalent.

Constraints

  • 1T1000
  • 1N100
  • 1X,Y105

No comments:

Post a Comment