WATERCOOLER1- Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Lavish Gupta
Tester: Istvan Nagy, Aryan
Editorialist: Vijay

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

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 YES if Chef should *rent the cooler, otherwise print *NO.

EXPLANATION:

What will be the cost of renting a water cooler for M months ?

The cost of renting a water cooler for one month equals X. Then the cost of renting a water cooler for M months will be equal to X+X+...... M times =M \cdot X.

When will Chef rent a water cooler for the summer season?

Chef will rent when the cost of renting is strictly less than the cost of buying a water cooler.
Cost of renting the cooler for the summer season consisting of M months = M \cdot X.
Cost of buying a new water cooler for the summer season = Y.
So, if M \cdot X<Y, Chef will rent otherwise buying a water cooler would be the better option.

TIME COMPLEXITY:

O(1) for each test case.

SOLUTION:

Editorialist's Solution
#include <bits/stdc++.h>
using namespace std;
#define nline '\n'

int main()
{   
   
    int t=1;
    cin >> t;

    while (t--)
    {
        int x, y, m;
        cin>>x>>y>>m;

        if(x*m<y)cout<<"YES"<<nline;
        else cout<<"NO"<<nline;
    }
}