Problem
In the games played so far in the tournament, your team has earned points. To qualify for the semi-finals, you must collect a total of at least points. You currently have games remaining in which you can earn points for a victory, points for a tie, and no points for a loss.
Is it possible that your team will make it to the semi-finals?
Input Format
- The first line will have the value , which represents the number of testcases. Then come the testcases.
- Each testcase has a single line of input and three numbers .
Output Format
For each test case, output in a single line YES if your team can qualify for the semi-finals, or NO if not possible.
Because output is case insensitive, "yes", "Yes", "YEs", "no", "nO" - all such strings will be accepted.
Constraints
Sample 1:
3 4 10 8 3 6 1 4 8 2
YES NO YES
Explanation:
Test Case : There are still games available. If you win games, lose games, and draw the remaining games, you will have a total of points, demonstrating that it is achievable.
Test Case : There is no way that you can qualify for the semi-finals.
Test Case : You will have points if you win all of the remaining games. As a result, qualifying for the semi-finals is possible ().
Program :
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* 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
{
// your code goes here
int p,q,r,t,a;
Scanner sc=new Scanner(System.in);
t=sc.nextInt();
while(t-->0){
p=sc.nextInt();
q=sc.nextInt();
r=sc.nextInt();
a=r*2;
if(p+a>=q)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
0 Comments