Problem
Chef has finally got the chance of his lifetime to drive in the 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 seconds and Chef's finish time as 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 , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, two space separated integers and denoting the fastest finish time and Chef's finish time respectively.
Output Format
For each test case, output if Chef will be allowed to race in the main event, else output .
You may print each character of the string in uppercase or lowercase (for example, the strings , , and will all be treated as identical).
Miami GP codechef problem solved by java.
Code:
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;
/* 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
{
Scanner sc = new Scanner (System.in);
double result =0;
int t = sc.nextInt();
for(int i=0; i<t; i++){
int x = sc.nextInt();
int y = sc.nextInt();
result = 1.07*x;
if(result>=y){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}