Problem Link
Chef and App Problem
DIFFICULTY:
Cakewalk
PREREQUISITES :
None
PROBLEM:
Chef is an application Developer , he can make x apps in 1 hour. He works in company, where he needs to complete tasks in given amount of time. He has been given y hours and and need to make z apps in it. Tell whether chef can make the applications in the given time or not.
Explanation:
From the problem, it is quite clear that there are only two conditions that are to be followed. If chef can complete the task, then it’s “YES”,
else it is “NO”. So the number of apps that Chef can make if he can make x apps in 1 hour is x*y. Now the two conditions are:
-
If x*y >=z, that is number of apps made by him in the given time is greater than or equal to the apps he needs to make for the company, then answer
is “YES” -
Else the answer is “NO”
if ((x * y) >= z) cout << "YES" << endl; else cout << "NO" << endl;
SOLUTIONS:
#include
using namespace std;
int main()
{
int t;
cin >> t;
while (t-- > 0)
{
int x, y, z;
cin >> x;
cin >> y;
cin >> z;
if ((x * y) >= z)
{
cout << “YES” << endl;
}
else
{
cout << “NO” << endl;
}
}
return 0;
}