CodechefMay 27, 2025

Cup Finals

Hazrat Ali

Codechef

Given that the skills of the teams competing in the final are XX and YY respectively, determine whether Chef will find the game interesting or not.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of testcases. The description of TT testcases follows.
  • Each testcase consists of a single line of input containing three space-separated integers XXYY, and DD — the skill levels of the teams and the maximum skill difference.

Output Format

For each testcase, output "YES" if Chef will find the game interesting, else output "NO" (without the quotes). The checker is case-insensitive, so "YeS" and "nO" etc. are also acceptable.

Constraints

  • 1≤T≤2000
  • 1≤X,Y≤100
  • 0≤D≤100

Sample 1:

Input
3
5 3 4
5 3 1
5 5 0

Output
YES
NO
YES



Solution

#include <stdio.h>

int main(void)
{

    int m;
    scanf("%d",&m);
    while(m--)
    {
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
        if(a>=b)
        {
            if(a-b > c)
                printf("NO\n");
            else printf("YES\n");
        }
        else
        {
            if(b-a > c)
                printf("NO\n");
            else printf("YES\n");
        }
    }
    return 0;
}




 

Comments