[Solution] 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.

[Solution] The Cooler Dilemma 1 solution codechef

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 𝚈𝙴𝚂YES if Chef should rent the cooler, otherwise print 𝙽𝙾NO.

Input Format

  • 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 𝚈𝙴𝚂YES if Chef should rent the cooler, otherwise output 𝙽𝙾NO.

You may print each character of the string in uppercase or lowercase (for example, the strings 𝚈𝚎𝚂YeS𝚢𝙴𝚜yEs𝚢𝚎𝚜yes and 𝚈𝙴𝚂YES will all be treated as identical).

[Solution] 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

Sample Output 1 

YES
NO
NO

The Cooler Dilemma 1 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.

For Solution

Click here

Leave a Comment