RCB AND PLAYOFFS solution in C++ language.- Codechef
RCB AND PLAYOFFS
Problem Code: RCBPLAY
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
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
- 1 ≤ T ≤ 5000
- 0 ≤ A, B ≤ 1000000
Sample Input 1
3
4 10 8
3 6 1
4 8 2
Sample Output 1
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.
. . .
Solution in C++.
#include <iostream> using namespace std; int main() { // your code goes here int t; cin >> t; while(t--){ int a, b, c; cin >> a >> b >> c; if((a + 2*c)>=b) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
Try Solution On The C-Playground : https://bit.ly/3rGd0Bh
Comments
Post a Comment