QUALIFY - Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Utkarsh Gupta
Tester: Abhinav Sharma, Manan Grover
Editorialist: Lavish Gupta

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

In a coding contest, there are two types of problems:

  • Easy problems, which are worth 1 point each
  • Hard problems, which are worth 2 points each

To qualify for the next round, a contestant must score at least X points. Chef solved A Easy problems and B Hard problems. Will Chef qualify or not?

EXPLANATION:

Chef has solved A Easy problems and B Hard problems, so total number of points that the Chef has got = A + 2\cdot B.

If A + 2 \cdot B \geq X, then Chef has qualified, otherwise Chef has not qualified.

TIME COMPLEXITY:

O(1) for each test case.

SOLUTION:

Editorialist's Solution
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll ,ll>
using namespace std ;
const ll z = 998244353 ;


int main()
{

    int t ;
    cin >> t ;
    while(t--)
    {
        int x , a , b ;
        cin >> x >> a >> b ;

        int points = a + 2*b ;

        if(points >= x)
            cout << "QUALIFY" << endl ;
        else
            cout << "NOTQUALIFY" << endl ;
    }

    return 0;
}