MONEYMAT - Editorial

PROBLEM LINK:

Practice
Contest
Author: Setter’s name
Tester: Tester’s name(roshangupta691 | CodeChef User Profile for Roshan Sah | CodeChef)(shivam1605 | CodeChef User Profile for Shivam Manishbhai Sarang | CodeChef)
Editorialist: Editorialist’s name

DIFFICULTY: EASY

PREREQUISITES: Math

PROBLEM:

On a fine morning, chef leaves his house for the office. after
sometime he found that he has forgot his wallet at home. But he
has X amount of money in his pocket. now he has two option by
which he can go to his office.

  1. Taxi, it’s one way cost is Y ₹.
  2. Bus, it’s one way cost is Z ₹.

Your task is to help chef to know whether he can go to his office
and comeback or not with X amount of money.

EXPLANATION:

Sample Test case:
Input:
3
100 45 65
45 25 60
46 25 23

Output:
Yes
No
Yes

  • Test Case1: Chef has 100 ?. He can use taxi to go to office and
    come back that will cost 90 ?.

SOLUTIONS:

Setter's Solution
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        if((2*y<=x) || (2*z<=x))
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    return 0;
}