Team RCB has earned X points in the games it has played so far in this year's IPL.Code chef

 

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






OURSHOPKEEPER







#include <iostream>
using namespace std;
int main()
{
    int xyzt;
    // x score earned
    // y to least score to qualify
    // z  no of games 2 win ,  1 draw, no loss
    cin>>t;
    while (t--)
    {
        cin >> x; //  4
        cin >> y; //  10
        cin >> z; //  8
        while (z > 0)
        {
            if (x <= y - 2)
            {
                x = x + 2;
            }
            else if (x <= y - 1)
            {
                x = x + 1;
            }
            else
                x = x;
            z--;
        }
        if (x >= y)
        {
            cout << "yes";
        }
        else
            cout << "No";
    }
}







    


Click on the above button to download the code.



Post a Comment

If you have furthur QUERIES please let us know

Previous Post Next Post