The Cooler Dilemma 1 CodeChef Solution

Problem – The Cooler Dilemma 1 CodeChef Solution

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 \texttt{YES}YES if Chef should rent the cooler, otherwise print \texttt{NO}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 XX, YY and MM, as described in the problem statement.

Output Format

For each test case, output \texttt{YES}YES if Chef should rent the cooler, otherwise output \texttt{NO}NO.

You may print each character of the string in uppercase or lowercase (for example, the strings \texttt{YeS}YeS, \texttt{yEs}yEs, \texttt{yes}yes and \texttt{YES}YES will all be treated as identical).

Constraints

  • 1 \leq T \leq 1001≤T≤100
  • 1 \leq X, M \leq 10^41≤X,M≤104
  • 1 \leq Y \leq 10^81≤Y≤108

Sample 1:

Input: 3
5 10 1
5 10 2
5 10 3
Output: 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.

The Cooler Dilemma 1 CodeChef Solution in Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		while (t-- > 0) {
		  String[] line = br.readLine().split(" ");
		  int x = Integer.parseInt(line[0]);
		  int y = Integer.parseInt(line[1]);
		  int m = Integer.parseInt(line[2]);
		  
		  System.out.println(x * m < y ? "YES" : "NO");
		}
	}
}

The Cooler Dilemma 1 CodeChef Solution in Pyth 3

# cook your dish here
t=int(input())
for i in range(t):
    x,y,m=map(int,input().split())
    a=x*m
    if a<y:
        print("yes")
    else:
        print("no")
    
    

The Cooler Dilemma 1 CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int x, y, m;
	    cin>>x>>y>>m;
	    if(x*m< y){
	        cout<<"YES";
	    }
	    else{
	        cout<<"NO";
	    }
	    cout<<endl;
	}
	return 0;
}
The Cooler Dilemma 1 CodeChef Solution Review:

In our experience, we suggest you solve this The Cooler Dilemma 1 CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the The Cooler Dilemma 1 CodeChef Solution

Find on CodeChef

Conclusion:

I hope this The Cooler Dilemma 1 CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.