Miami GP CodeChef Solution

Problem – Miami GP CodeChef Solution

Chef has finally got the chance of his lifetime to drive in the F1 tournament. But, there is one problem. Chef did not know about the 107% rule and now he is worried whether he will be allowed to race in the main event or not.

Given the fastest finish time as X seconds and Chef’s finish time as Y seconds, determine whether Chef will be allowed to race in the main event or not.

Note that, Chef will only be allowed to race if his finish time is within 107% of the fastest finish time.

Input Format

  • First line will contain T, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, two space separated integers X and Y denoting the fastest finish time and Chef’s finish time respectively.

Output Format

For each test case, output YES if Chef will be allowed to race in the main event, else output NO.

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

Constraints

  • 1≤T≤2⋅10^4
  • 1≤XY≤200

Sample 1:

Input: 4
1 2
15 16
15 17
100 107
Output: NO
YES
NO
YES

Explanation:

Test case 1: The fastest car finished in 1 second. Thus, Chef should have finished on or before 1.07 seconds to ensure qualification but he finished in 2 seconds. Hence, Chef will not be allowed to race in the main event.

Test case 2: The fastest car finished in 15 seconds. Thus, Chef should have finished on or before 16.05 seconds to ensure qualification and he managed to finish in 16 seconds. Hence, Chef will be allowed to race in the main event.

Test case 3: The fastest car finished in 15 seconds. Thus, Chef should have finished on or before 16.05 seconds to ensure qualification but he finished in 17 seconds. Hence, Chef will not be allowed to race in the main event.

Test case 4: The fastest car finished in 100 seconds. Thus, Chef should have finished on or before 107 seconds to ensure qualification and he finished just in time for qualification. Hence, Chef will be allowed to race in the main event.

Miami GP CodeChef Solution in C++17

#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int x,y;
        cin>>x>>y;
        y*=100;
        x*=107;
        if(y<=x)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}

Miami GP CodeChef Solution in Pyth 3

T = int(input())
for i in range(T):
    X,Y=map(int,input().split())
    if Y<=X*1.07:
        print("YES")
    else:
        print("NO")
    

Miami GP 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
	{
		int testCase, carSpeed, chefSpeed;
		
		Scanner sc = new Scanner(System.in);
		
		testCase = sc.nextInt();
		
		while(testCase -- > 0){
		    carSpeed = sc.nextInt();
		    
		    chefSpeed = sc.nextInt();
		    
		    if((carSpeed * 1.07) >= chefSpeed){
		        System.out.println("YES");
		    }else{
		        System.out.println("NO");
		    }
		}
	}
}
Miami GP CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Miami GP 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.