Editorial - ECNOV09

PROBLEM LINK:

Practice

Encoding November 2020 Contest

Author: arnie8991

Tester: sandeep1103

Editorialist: arnie8991

DIFFICULTY:

Cakewalk

PREREQUISITES:

If-Else statements

Problem

The students of Codechef Middle School are visiting an amusement park. The children want to go on a ride, however, there is a minimum height requirement of X cm. Determine if the children are eligible to go on the ride.

Print “Yes” if they are eligible, “No” otherwise.

EXPLANATION:

This is a basic cakewalk problem in which we just need to check if the height of a child >= the minimum permissible height for the ride. If the child passes the criteria, he/she is eligible and this print “Yes”, otherwise print “No”.

TIME COMPLEXITY

Comparison is done in O(1) time. Thus time complexity/test case is O(1)

SOLUTIONS:

Setter's Solution
import java.util.*;

public class Main {

    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        int t = sc.nextInt();

        while(t-- > 0){

            int ht = sc.nextInt();

            int limit = sc.nextInt();

            if (ht >= limit){

                System.out.println("Yes");

            }

            else{

                System.out.println("No");

            }

        }

    }

}