PROBLEM LINK:
Setter: soumyadeep_21
Testers: tabr, tejas10p
Editorialist: kiran8268
DIFFICULTY:
342
PREREQUISITES:
None
PROBLEM:
Chef wants to visit the fair along with his N friends. Also Chef has got K passes. Given a person can enter the fair using one pass, we need to find out Will Chef be able to enter the fair with all his N friends.
EXPLANATION:
Total number of people who wish to enter the fair is (N+1) [ i.e. Chef + N friends ]
Given one person needs one pass to enter the fair, total number of passes required is to enter the fair is (N+1) .
Thus to check if Chef will be able to enter the fair with all his N friends, Chef should collect passes K>N
TIME COMPLEXITY:
Time complexity is O(1).
SOLUTION:
Editorialist's Solution
cin >> t;
while (t--)
{
int n,k;
cin >> n>> k;
if (n < k)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}