Problem
Team RCB has earned points in the games it has played so far in this year's IPL. To qualify for the playoffs they must earn at least a total of points. They currently have games left, in each game they earn points for a win, point for a draw, and no points for a loss.
Is it possible for RCB to qualify for the playoffs this year?
Input Format
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, three integers .
Output Format
For each test case, output in one line YES if it is possible for RCB to qualify for the playoffs, or NO if it is not possible to do so.
Output is case insensitive, which means that "yes", "Yes", "YEs", "no", "nO" - all such strings will be acceptable.
Constraints
Sample 1:
3 4 10 8 3 6 1 4 8 2
YES NO YES
Explanation:
Test Case : There are games remaining. Out of these games, if RCB wins games, loses games and draws the remaining games they will have a total of 10 points, this shows that it is possible for RCB to qualify for the playoffs.
Note: There can be many other combinations which will lead to RCB qualifying for the playoffs.
Test Case : There is no way such that RCB can qualify for the playoffs.
Test Case : If RCB wins all their remaining games, they will have end up with points. (
), hence it is possible for them to qualify for the playoffs. /* package codechef; // don't place package name! */
Program :
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
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0){
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int tot = a + (c * 2);
if(tot < b){
System.out.println("NO");
}
else{
System.out.println("YES");
}
}
}
}
0 Comments