PROBLEM LINK:
Author: Riddhish Lichade
Tester: Yogesh Deolalkar
Editorialist: Ram Agrawal
DIFFICULTY:
SIMPLE
PREREQUISITES:
Conditional Statement
PROBLEM:
Dre is a karate student. To achieve his next belt, he has to give a test. Dre wants to check if he can pass the test or not. He needs your help in determining so.
His strength is S. In the test, Dre has to break N tiles where the width of each tile is W. Strength of a tile can be calculated by multiplying its width by a factor X. Dre can break the tiles if his strength is greater than or equal to the strength of tiles.
Given X, help Dre find if he can pass the test or not.
QUICK EXPLANATION:
Strength of all The tiles is calculated by multiplying Number of tiles ( N) by its width (W) and Factor (X).
So, Dre can break the tiles if his strength is greater than or equal to the strength of tiles.
SOLUTIONS:
Setter's Solution
from sys import stdin
for _ in range(int(stdin.readline())):
n,s,w,x=map(int, stdin.readline().strip().split())
if(n*w*x<=s):
print("YES")
else:
print("NO")
Editorialist's Solution
#include <iostream>
using namespace std;
int main() {
// your code goes here
int T;
long long N,S,W,X,tilestrength,totaltilestrength;
cin>>T;
while(T--)
{
cin>>N>>S>>W>>X;
tilestrength=W*X;
totaltilestrength=N*tilestrength;
if(S>=totaltilestrength)
{
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
}
return 0;
}