Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

# Equalizing Numbers CodeChef Solution

## Problem – Equalizing Numbers CodeChef Solution

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 :

• Add dd to AA and subtract dd from BB.
• Add dd to BB and subtract dd from AA.

Chef is allowed to make as many operations as he wants. Can he make AA and BB equal?

#### Input Format

• First line will contain TT, number of test cases. Then the test cases follow.
• Each test case contains of a single line of input, two integers A, BA,B.

#### Output Format

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 yEsYesYeS, and YES will all be treated as identical).

#### Constraints

• 1 \leq T \leq 10001≤T≤1000
• 1 \leq A,B \leq 10001≤A,B≤1000

#### Sample 1:

Input:2
3 3
1 2

Output:
Yes
No

### Explanation:

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.

### Equalizing Numbers CodeChef Solution in C++14

#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;
}


### Equalizing Numbers CodeChef Solution in Java

/* 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");
}
}
}
}
}

##### Equalizing Numbers CodeChef Solution Review:

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

Find on CodeChef

##### Conclusion:

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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions