Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef has two integers AA and BB. In one operation he can choose any integer d,d, and make one of the following two moves :
Chef is allowed to make as many operations as he wants. Can he make AA and BB equal?
For each test case, if Chef can make the two numbers equal print YES
else print NO
.
You may print each character of the string in uppercase or lowercase (for example, the strings yEs
, Yes
, YeS
, and YES
will all be treated as identical).
Input:2
3 3
1 2
Output:
Yes
No
Test case 1: Since AA and BB are already equal, Chef does not need any operations.
Test case 2: It can be shown that AA and BB can never be made equal using any number of given operations.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int a,b;
cin>>a>>b;
if((a+b)%2==0){
cout<<"yes"<<endl;
}
else{
cout<<"no"<<endl;
}
}
return 0;
}
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
int t;
Scanner sc=new Scanner(System.in);
t=sc.nextInt();
for(int i=0;i<t;i++){
int a=sc.nextInt();
int b=sc.nextInt();
int d;
if(a==b){
System.out.println("Yes");
}
else{
if((a-b)%2==0){
System.out.println("Yes");
}
else{
System.out.println("No");
}
}
}
}
}
In our experience, we suggest you solve this Equalizing Numbers 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 Equalizing Numbers CodeChef Solution
I hope this Equalizing Numbers 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 >>