The Cooler Dilemma 1 solution codechef

The Cooler Dilemma 1 solution codechef

 

The summer is at its peak in Chefland. Chef is planning to purchase a water cooler to keep his room cool. He has two options available:

  • Rent a cooler at the cost of XX coins per month.
  • Purchase a cooler for YY coins.

Given that the summer season will last for MM months in Chefland, help Chef in finding whether he should rent the cooler or not.

Chef rents the cooler only if the cost of renting the cooler is strictly less than the cost of purchasing it. Otherwise, he purchases the cooler.

Print YESYES if Chef should rent the cooler, otherwise print NONO.

The Cooler Dilemma 1 solution codechef

  • The first line of input will contain an integer TT — the number of test cases. The description of TT test cases follows.
  • The first and only line of each test case contains three integers XXYY and MM, as described in the problem statement.

Output Format

For each test case, output YESYES if Chef should rent the cooler, otherwise output NONO.

You may print each character of the string in uppercase or lowercase (for example, the strings YeSYeSyEsyEsyesyes and YESYES will all be treated as identical).

The Cooler Dilemma 1 solution codechef

  • 1T1001≤T≤100
  • 1X,M1041≤X,M≤104
  • 1Y1081≤Y≤108

Sample Input 1 

3
5 10 1
5 10 2
5 10 3

The Cooler Dilemma 1 solution codechef  

YES
NO
NO

Explanation

Test case 11: Cost of renting the cooler =5=5 coins. Cost of purchasing the cooler =10=10 coins. So, Chef should rent the cooler as the cost of renting the cooler for 11 month is strictly less than purchasing it.

Test case 22: Cost of renting the cooler =10=10 coins. Cost of purchasing the cooler =10=10 coins. So, Chef should not rent the cooler as the cost of renting the cooler for 22 months is not strictly less than purchasing it.

Test case 33: Cost of renting the cooler =15=15 coins. Cost of purchasing the cooler =10=10 coins. So, Chef should not rent the cooler as the cost of renting the cooler for 33 months is not strictly less than purchasing it.

Leave a Comment