Air Conditioner Temperature CodeChef Solution

Problem – Air Conditioner Temperature CodeChef Solution

There are three people sitting in a room – Alice, Bob, and Charlie. They need to decide on the temperature to set on the air conditioner. Everyone has a demand each:

  • Alice wants the temperature to be at least AA degrees.
  • Bob wants the temperature to be at most BB degrees.
  • Charlie wants the temperature to be at least CC degrees.

Can they all agree on some temperature, or not?

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of a single line which contains three integers – A, B, CA,B,C.

Output Format

For each test case, output on a new line, “Yes” or “No”. “Yes”, if they can decide on some temperature which fits all their demands. Or “No”, if no temperature fits all their demands.

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

Constraints

  • 1001≤T≤100
  • 1 \leq A, B, C \leq 1001≤A,B,C≤100

Subtasks

  • Subtask 1 (10 points): 1 \leq M \leq 101≤M≤10
  • Subtask 2 (20 points): The sum of NN across all test cases won’t exceed 2020.
  • Subtask 3 (70 points): No further constraints.

Sample 1:

Input: 4
30 35 25
30 35 40
30 35 35
30 25 35

Output: 
Yes
No
Yes
No

Explanation:

Test Case 1: Alice wants the temperature to be \ge 30≥30, Bob wants it to be \le 35≤35, and Charlie wants it to be \ge 25≥25. The temperatures 30, 31, 32, 33, 34, 3530,31,32,33,34,35 all satisfy all their demands. So they can choose any of these 6 temperatures, and so the answer is “Yes”.

Test Case 2: Alice wants the temperature to be \ge 30≥30, Bob wants it to be \le 35≤35, and Charlie wants it to be \ge 40≥40. A number can’t be both \ge 40≥40, and \le 35≤35. So there is no temperature that satisfies all their demands. So the answer is “No”.

Test Case 3: Alice wants the temperature to be \ge 30≥30, Bob wants it to be \le 35≤35, and Charlie wants it to be \ge 35≥35. The temperature 3535 satisfies all their demands. So the answer is “Yes”.

Test Case 4: Alice wants the temperature to be \ge 30≥30, Bob wants it to be \le 25≤25, and Charlie wants it to be \ge 35≥35. A number can’t be both \ge 30≥30, and \le 25≤25. So there is no temperature that satisfies all their demands. So the answer is “No”.

Air Conditioner Temperature 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
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
        int T=sc.nextInt();
        while(T--!=0){
            int A=sc.nextInt();
            int B=sc.nextInt();
            int C=sc.nextInt();
            
            if(A<=B && C<=B)
            System.out.println("YES");
            else
            System.out.println("NO");
        }
	}
}

Air Conditioner Temperature CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int a,b,c,t;
	cin>>t;
	while(t--)
	{
	    cin>>a>>b>>c;
    if(b>=a && b>=c)
    {
        cout<<"Yes"<<endl;
    }
    else 
    {
        cout<<"No"<<endl;
    }
	}
	return 0;
}

Air Conditioner Temperature CodeChef Solution in Python3

T=int(input())
for i in range(T):
    A,B,C=list(map(int,input().split()))
    if(A<=B and C<=B):
        print("Yes")
    else:
        print("No")
    
Air Conditioner Temperature CodeChef Solution Review:

In our experience, we suggest you solve this Air Conditioner Temperature 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 Air Conditioner Temperature CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Air Conditioner Temperature 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.