[Solution] Equalizing Numbers solution codechef

Table of Contents

Equalizing Numbers solution codechef

Equalizing Numbers solution codechef – Chef has two integers A and B. In one operation he can choose any integer d, and make one of the following two moves :

  • Add d to A and subtract d from B.
  • Add d to B and subtract d from A.

Chef is allowed to make as many operations as he wants. Can he make A and B equal?

Equalizing Numbers solution codechef

  • First line will contain T, number of test cases. Then the test cases follow.
  • Each test case contains of a single line of input, two integers A, 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).

Equalizing Numbers solution codechef

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

Sample 1:

Input

Output

2
3 3
1 2
Yes
No

Equalizing Numbers solution codechef

Test case 1: Since A and B are already equal, Chef does not need any operations.

Test case 2: It can be shown that A and B can never be made equal using any number of given operations.

For Solution

“Click Here”

Leave a Comment