Codechef Problems: Protein Diet (LMP1)

 Problem Statement

You consume X grams of protein daily. A balanced diet requires at least Y grams of protein per day.

Determine whether your daily protein intake fulfills the recommended requirement. The daily protein intake is considered fulfilled if and only if X is greater than or equal to Y.

Input Format

  • The first line of input contains two space-separated integers X and Y - the grams of protein consumed daily and the minimum grams of protein recommended respectively.

Output Format

Print YES if the daily protein intake meets or exceeds the recommended amount.
Otherwise, print NO.

Each letter of the output may be printed in either uppercase or lowercase, i.e, the strings NOnoNo, and nO will all be treated as equivalent.

Constraints

  • 1X,Y100

Solution: 

Given: X: Daily Protein Intake and Y: Daily Protein Requirement 

if ( X >= Y ) -> Means protein intake is Greater than or equals to Protein requirement so it meets the required condition so print YES 

else -> Means protein intake is less than protein requirement so it does not meet the required condition so print NO

Code Solution: 

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

int main() {
    int x, y; 
    cin >> x >> y; 
    
    if(x >= y){
        cout << "YES" << endl; 
    } else {
        cout << "NO" << endl; 
    }
    
    return 0; 
}

Comments

Popular posts from this blog

Codechef Problems: Triangles (TRIANGLE7)

Codechef problems : New Year Resolution (NYRES)

Codechef Problems: Selling Sandwiches (SANDWSHOP)