Codechef Problems: Too Much Homework! (HWFIN)
Problem Statement:
https://www.codechef.com/problems/HWFIN
Solution:
Given, X : number of questions chef has already done
Y :
number of questions in each worksheet
10 : number
of worksheets can be solved
100: questions
needed to be solved for full marks
To find, check whether chef can get full marks?
Number of questions chef can do be solving worksheets = number
of worksheets * questions in each worksheet
=
10 * Y
Number of questions chef need to get full marks = 100 – X
Condition 1 : (10 * Y) >= (100 – X)
Output : YES
Condition 2 : otherwise
Output: NO
Code Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
if (10 * y >=
100 - x) {
cout <<
"YES" << endl;
} else {
cout <<
"NO" << endl;
}
return 0;
}
Comments
Post a Comment