Codechef Problems: Assignment Due (P1_175)
Problem Statement:
You are eagerly awaiting for the upcoming Technex event organized by IIT BHU Varanasi! However, you also have an assignment due. The deadline for the assignment is in days, and it takes you days to complete it.
Determine whether you can finish the assignment on or before the deadline.
Input Format
The input consists of two space-separated integers and , where:
- denotes the number of days required to complete the assignment.
- denotes the number of days remaining until the deadline.
Output Format
Print YES if you can complete the assignment on or before the due date, otherwise print NO
You may print each character of the string in uppercase or lowercase (for example, the strings YES, yEs, yes, and yeS will all be treated as identical).
Constraints
Solution:
Given,
X : Number of Days required to Complete the Assignment
Y : Number of Days till Assignment Deadline
To find: Whether the Assignment will be Completed before Deadline
Condition 1 : If X <= Y
i.e., number of days required to complete the assignment will be less than or equals to number of days till assignment deadline
this means assignment can be completed before deadline so answer will be "YES"
Condition 2: Else or X > Y
i.e., number of days required to complete the assignment will be greater than the number of days till assignment deadline
this means assignment can not be completed before deadline so answer will be "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;
}
}
Comments
Post a Comment