Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
There is a fair going on in Chefland. Chef wants to visit the fair along with his N friends. Chef manages to collect K passes for the fair. Will Chef be able to enter the fair with all his N friends?
A person can enter the fair using one pass, and each pass can be used by only one person.
For each test case, print on a new line YES
if Chef will be able to enter the fair with all his N friends and NO
otherwise.
You may print each character of the string in either uppercase or lowercase (for example, the strings yEs
, yes
, Yes
, and YES
will all be treated as identical).
Input: 4
5 8
6 3
2 2
1 2
Output: YES
NO
NO
YES
Test case 1: Chef needs 5 passes for his friends and one pass for himself and he collected 8 passes. Thus he will be able to enter the fair with all his friends.
Test case 2: Chef needs 6 passes for his friends and one pass for himself while he collected only 3 passes. Thus he will not be able to enter the fair with all his friends, only three of them can enter the fair.
Test case 3: Chef needs 2 passes for his friends and one pass for himself while he collected only 2 passes. Thus either Chef or one of his friends can’t enter the fair.
Test case 4: Chef needs a total of 2 passes, one for himself and one for his friend. He collected 2 passes. Thus he will be able to enter the fair with his friend.
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
if(k>=n+1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t= sc.nextInt();
for (int i=0;i<t;i++){
int n = sc.nextInt();
int k = sc.nextInt();
if(k>n){
System.out.println("yes");
}
else{
System.out.println("no");
}
}
}
}
for i in range(int(input())):
a,b=map(int,input().split(" "))
if a+1<=b:
print("YES")
else:
print("NO")
In our experience, we suggest you solve this Passes for Fair CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Passes for Fair CodeChef Solution
I hope this Passes for Fair CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>