PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Setter: Daanish Mahajan
Tester: Manan Grover, Tejas Pandey
Editorialist: Kanhaiya Mohan
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
A project should power Chefland by generating at least A units of power each year for the next B years.
Help Chef determine whether the group will get funded assuming that the moon has X grams of Helium-3 and 1 gram of Helium-3 provides Y units of power.
QUICK EXPLANATION:
- If A \cdot B \leq X \cdot Y, the answer is
YES
. Otherwise, the answer isNO
.
EXPLANATION:
The requirement of Chefland is A units of power per year. For B years, a total of A \cdot B units of power is required.
Moon has X grams of Helium-3 and each gram can provide Y units of power. Thus, the total power available is X \cdot Y units.
The assignment would be funded only if the available power is greater than or equal to the required power.
Thus, the answer is YES
if, A \cdot B \leq X \cdot Y. Otherwise the answer is NO
.
TIME COMPLEXITY:
The time complexity is O(1) per test case.
SOLUTION:
Editorialist's Solution
#include <iostream>
using namespace std;
int main() {
int t;
cin>> t;
while(t--){
int A, B, X, Y;
cin>>A>>B>>X>>Y;
if(A*B <= X*Y){
cout<<"YES";
}
else{
cout<<"NO";
}
cout<<endl;
}
return 0;
}