Chef on Vacation: CHEFVACATION

Problem link: https://www.codechef.com/CU1PP0006/problems/CHEFVACATION

Problem code: CHEFVACATION

After a very long time, the Chef has a vacation. Chef has planned for two trips during this vacation – one with his family and the other with his friends. The family trip will take XX days and the trip with friends will take YY days. Currently, the dates are not decided but the vacation will last only for ZZ days.

Chef can be in at most one trip at any time and once a trip is started, Chef must complete it before the vacation ends. Will Chef be able to go on both these trips if he chooses the dates optimally?

Solution:

#include<bits/stdc++.h>
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        if((x+y)<=z)
        cout<<"YES\n";
        else
        cout<<"NO\n";
    }
    return 0;
}
See also  Chess Match: BLITZ3_2