Team RCB has earned XX 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 YY points. They currently have ZZ games left, in each game they earn 22 points for a win, 11 point for a draw, and no points for a loss. Is it possible for RCB to qualify for the playoffs this year?

RCB and Playoffs solution codechef

Team RCB has earned XX 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 YY points. They currently have ZZ games left, in each game they earn 22 points for a win, 11 point for a draw, and no points for a loss.

Is it possible for RCB to qualify for the playoffs this year?

RCB and Playoffs solution codechef

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, three integers X,Y,ZX,Y,Z.

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.

RCB and Playoffs solution codechef

  • 1T50001≤T≤5000
  • 0X,Y,Z10000≤X,Y,Z≤1000

Sample Input 1 

3
4 10 8
3 6 1 
4 8 2 

Sample Output 1 

YES
NO
YES

RCB and Playoffs solution codechef

Test Case 11: There are 88 games remaining. Out of these 88 games, if RCB wins 22 games, loses 44 games and draws the remaining 22 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 22: There is no way such that RCB can qualify for the playoffs.

Test Case 33: If RCB wins all their remaining games, they will have end up with 88 points. (4+22=84+2∗2=8), hence it is possible for them to qualify for the playoffs.

Leave a Comment