Skip to content
neoideasblog

neoideasblog

  • Home
    • Privacy Policy
    • About Us
    • Contact Us
    • Terms
  • Trivia
  • Results
  • Admit Cards
  • Sitemaps
  • Toggle search form

Take discount or Not solution codechef

Posted on May 28, 2022May 28, 2022 By Admin No Comments on Take discount or Not solution codechef

There are NN items in a shop. You know that the price of the ii-th item is AiAi. Chef wants to buy all the NN items.

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

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 coupon is strictly less than the price he pays without buying the discount coupon.

Input Format Take discount or Not solution codechef

  • The first line of input will contain a single integer TT, 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 — NN, XX, and YY.
    • The second line contains NN space-separated integers — A1,A2,…,ANA1,A2,…,AN.
ALSO READ:-   [Question] "Firenze" Is The Italian Name For Which City?

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 coupon, CouPoN, and COUPON will all be treated as equivalent.

Take discount or Not solution codechef

  • 1≤T≤10001≤T≤1000
  • 1≤N≤1001≤N≤100
  • 1≤X,Y≤1051≤X,Y≤105
  • 1≤Ai≤1051≤Ai≤105

Sample Input 1 

5
4 30 10
15 8 22 6
4 40 10
15 8 22 6
4 34 10
15 8 22 6
2 10 100
60 80
3 30 5
50 60 50

Sample Output 1 

COUPON
NO COUPON
NO COUPON
COUPON
NO COUPON

Take discount or Not solution codechef Explanation

Test case 11: The original cost of the items is 15+8+22+6=5115+8+22+6=51. Buying the coupon costs 3030, and after buying it the cost of buying all the items is 5+0+12+0=175+0+12+0=17. The total cost of buying everything with the coupon is 30+17=4730+17=47, which is strictly less than 5151. So, Chef will buy the coupon.

ALSO READ:-   [Question] Deion Sanders Won Super Bowl XXX With Which Of These Teams In 1996?

Test case 22: The original cost of the items is 15+8+22+6=5115+8+22+6=51. Buying the coupon costs 4040, and after buying it the cost of buying all the items is 5+0+12+0=175+0+12+0=17. The total cost of buying everything with the coupon is 40+17=5740+17=57, which is more than 5151. So, Chef will not buy the coupon.

Test case 33: The original cost of the items is 5151. Buying the coupon costs 3434, and the cost of buying all the items after using it is 1717, making the total cost 34+17=5134+17=51. Since this is not strictly less than the original cost, Chef won’t buy the coupon.

ALSO READ:-   [Question] What is the smallest composite number?

Test case 44: The original cost of the items is 140140, the coupon costs 1010, and the cost of buying everything after using the coupon is 00. Since 10+0<14010+0<140, Chef will buy the coupon.

Admin

I am the Founder and the creator of the blog neoideasblog.com where we share latest trivia questions and answers on a daily basis.

Trivia

Post navigation

Previous Post: [Question] How long is a lane in standard 10-pin bowling?
Next Post: [Question] What region is known for its traditional dish of lutefisk?

Related Posts

[Question] What river flows through Paris? Trivia
[Question] 5. Here is the one everyone should know. In the song "Tie A ______ Ribbon Round The Ole Oak Tree" by Dawn, what colour was the ribbon? Trivia
[Question] What animal has the strongest bite? Trivia
[Question] "Bel-Air" is based on a ’90s sitcom starring what actor? Trivia
[Answer] What is the only mammal that can fly? Trivia
Interactive Treasure Hunt solution codeforces Trivia

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Archives

  • June 2022
  • May 2022
  • April 2022

Categories

  • Admit Cards
  • Results
  • Trivia

Disclaimer

Disclaimer: Our website name Neoideasblog.com. we are just a news portal that covers various updates and stories.

Copyright © 2022 neoideasblog.

Powered by PressBook Grid Blogs theme