Miami GP Solution

Problem

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 \texttt{YES} if Chef will be allowed to race in the main event, else output \texttt{NO}.

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

Constraints

  • 1 \leq T \leq 2\cdot 10^4
  • 1 \leq X \leq Y \leq 200

Sample 1:

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



Program :

 #include <stdio.h>

int main(void) 

{

    float a,b;

int c;

scanf("%d",&c);

while(c--)

{

    scanf("%f%f",&a,&b);

    if(1.07*a>=b)

    {

        printf("YES");

    }

    else

    {

        printf("NO");

    }

    printf("\n");

}

return 0;

}


Post a Comment

0 Comments