adplus-dvertising

Equalize AB Codechef Solution

We Are Discuss About CODECHEF SOLUTION

Equalize AB Codechef Solution

Equalize AB Codechef Solution

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Problem

You are given two numbers A and B along with an integer X. In one operation you can do one of the following:

  • Set¬†A = A + X¬†and¬†B = B – X
  • Set¬†A = A – X¬†and¬†B = B + X

Determine if you can make A and B equal after applying the operation any number of times (possibly zero).

Input Format

  • The first line contains a single integer¬†T¬†‚ÄĒ the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers¬†A, B¬†and¬†X¬†‚ÄĒ the parameters mentioned in the statement.

Output Format

For each test case, output YES if you can make A and B equal after applying the operation any number of times (possibly zero). Otherwise, output NO.

You can output each letter in any case i.e. YES, yes, yEs are all considered the same.

Constraints

  • 1 \leq T \leq 1000
  • 1 \leq A, B, X \leq 10^9

Sample 1:

Input

Output

4
5 7 1
3 4 2
4 4 6
2 5 3
YES
NO
YES
NO

Explanation:

Test Case 1: The initial values of (A, B) is (5, 7). We can perform the following operation: (5,7) \xrightarrow{A = A + X, B = B РX} (6,6).

Test Case 2: It can be proven that we can not make A equal to B using the given operations.

Test Case 3: A and B are already equal.

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

 

SOLUTION

Here Discuss About Equalize AB Codechef Solution

SOLUTION

Equalize AB Codechef Solution

SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE

Related Posts

Leave a Reply

Your email address will not be published.