Codechef Problems : Time Machine (TIMA)

 Problem Statement: 


Solution: 

Given, 
    X : Present year 
    25: maximum year span in a time machine 

to find, can chef reach 2050 by using time machine now 

the maximum year span time machine can travel in future is 25 years so to reach year 2050 present year should be at least (2050 - 25) = 2025 

condition 1 : X >= 2025 
output : YES 

condition 2 : otherwise 
output : NO 

Code Solution: 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int x;
    cin >> x;

    if (x >= 2025) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Comments