Roller Coaster CodeChef Solution

Problem – Roller Coaster CodeChef Solution

Chef’s son wants to go on a roller coaster ride. The height of Chef’s son is X inches while the minimum height required to go on the ride is H inches. Determine whether he can go on the ride or not.

Input Format

  • The first line contains a single integer T – the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two integers X and H – the height of Chef’s son and the minimum height required for the ride respectively.

Output Format

For each test case, output in a single line, YES if Chef’s son can go on the ride. Otherwise, output NO.

You may print each character of YES and NO in uppercase or lowercase (for example, yesyEsYes will be considered identical)

Constraints

  • 1 \leq T \leq 10001≤T≤1000
  • 1 \leq X, H \leq 1001≤X,H≤100

Sample 1:

Input: 4
15 20
50 48
32 32
38 39

Output: NO
YES
YES
NO

Explanation:

Test case 1: Chef’s son can not go on the ride as his height < the minimum required height.

Test case 2: Chef’s son can go on the ride as his height ≥ the minimum required height.

Test case 3: Chef’s son can go on the ride as his height ≥ the minimum required height.

Test case 4: Chef’s son can not go on the ride as his height < the minimum required height.

Roller Coaster CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {

int T,X,H;
cin>>T;
for(int i=0;i<T;i++){
    cin>>X>>H;
    if(X>=H){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



	return 0;
}

Roller Coaster CodeChef Solution in Python3

t=int(input())
for i in range(t):
    X,H=map(int,input().split())
    if H<=X:
        print("YES")
    else:
        print("NO")
    

Roller Coaster CodeChef Solution in Java


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

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int i=0;i<T;i++){
		    int x = sc.nextInt();
		    int h = sc.nextInt();
		    if(x>=h){
		        System.out.println("YES");
		    }
		    else{
		        System.out.println("NO");
		    }
		}
	}
}
Roller Coaster CodeChef Solution Review:

In our experience, we suggest you solve this Roller Coaster 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 Roller Coaster CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Roller Coaster 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.