# MOVIETIME - Editorial

https://www.codechef.com/CDGK2022/problems/MOVIETIME

Author: vamshi365,
Testers: harisankar14, indu712,lokesh_la9,gayathrii,kirtana01
Editorialist: bvsyaswanth1, kick_jayanth

DIFFICULTY: EASY

PREREQUISITES: Basic Math

PROBLEM:
Chef has N friends, he wants to go to a movie and he has X rupees of money with him. In a theater where Y seats are vacant, where every seat costs A rupees.

Can Chef take his friends to the movie with him? If yes print the output as YES or else print NO.

EXPLANATION:
Chef has N number of friends. There are Y number of seats. The first condition that needs to be satisfied is that Y should be greater than or equal to N+1(number of people including chef).
Now, we should check whether chef has enough money or not. Each ticket costs A rupees. So, N+1 tickets costs A*(N+1). So, the value of X should be greater than A*(N+1). When these two conditions get satisfied, we should print YES.

TIME COMPLEXITY: O(1) per test case

CODE:

Editorialist’s code (Python):

``````for _ in range(int(input())):
n,x,y,a = map(int,input().split())
print('yes' if (n+1)<=y and a*(n+1)<=x else ‘no')
``````

Tester’s code (C++):

``````#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,x,y,a;
cin>>n>>x>>y>>a;
bool c = false;
if(y>=n+1){
int val;
val = (n+1)*a;
if(val <= x){
c = true;
}
}
if(c == true){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
}
``````