1260B.md (1538B)
1 Source: https://codeforces.com/problemset/problem/1260/B 2 3 B. Obtain Two Zeroes 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given two integers $a$ and $b$. You may perform any number of operations on them (possibly zero). 22 23 During each operation you should choose any positive integer $x$ and set $a := a - x$, $b := b - 2x$ or $a := a - 2x$, $b := b - x$. Note that you may choose different values of $x$ in different operations. 24 25 Is it possible to make $a$ and $b$ equal to $0$ simultaneously? 26 27 Your program should answer $t$ independent test cases. 28 29 Input 30 31 The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases. 32 33 Then the test cases follow, each test case is represented by one line containing two integers $a$ and $b$ for this test case ($0 \le a, b \le 10^9$). 34 35 Output 36 37 For each test case print the answer to it — YES if it is possible to make $a$ and $b$ equal to $0$ simultaneously, and NO otherwise. 38 39 You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer). 40 41 Example 42 43 Input 44 45 ``` 46 3 47 6 9 48 1 1 49 1 2 50 ``` 51 52 Output 53 54 ``` 55 YES 56 NO 57 YES 58 ``` 59 60 Note 61 62 In the first test case of the example two operations can be used to make both $a$ and $b$ equal to zero: 63 64 1. choose $x = 4$ and set $a := a - x$, $b := b - 2x$. Then $a = 6 - 4 = 2$, $b = 9 - 8 = 1$; 65 2. choose $x = 1$ and set $a := a - 2x$, $b := b - x$. Then $a = 2 - 2 = 0$, $b = 1 - 1 = 0$.