1521A.md (1700B)
1 Source: https://codeforces.com/problemset/problem/1521/A 2 3 A. Nastia and Nearly Good Numbers 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 Nastia has $2$ positive integers $A$ and $B$. She defines that: 22 23 * The integer is good if it is divisible by $A \cdot B$; 24 * Otherwise, the integer is nearly good, if it is divisible by $A$. 25 26 For example, if $A = 6$ and $B = 4$, the integers $24$ and $72$ are good, the integers $6$, $660$ and $12$ are nearly good, the integers $16$, $7$ are neither good nor nearly good. 27 28 Find $3$ different positive integers $x$, $y$, and $z$ such that exactly one of them is good and the other $2$ are nearly good, and $x + y = z$. 29 30 Input 31 32 The first line contains a single integer $t$ ($1 \le t \le 10\,000$) — the number of test cases. 33 34 The first line of each test case contains two integers $A$ and $B$ ($1 \le A \le 10^6$, $1 \le B \le 10^6$) — numbers that Nastia has. 35 36 Output 37 38 For each test case print: 39 40 * "YES" and $3$ different positive integers $x$, $y$, and $z$ ($1 \le x, y, z \le 10^{18}$) such that exactly one of them is good and the other $2$ are nearly good, and $x + y = z$. 41 * "NO" if no answer exists. 42 43 You can print each character of "YES" or "NO" in any case. 44 45 If there are multiple answers, print any. 46 47 Example 48 49 Input 50 51 ``` 52 3 53 5 3 54 13 2 55 7 11 56 ``` 57 58 Output 59 60 ``` 61 YES 62 10 50 60 63 YES 64 169 39 208 65 YES 66 28 154 182 67 ``` 68 69 Note 70 71 In the first test case: $60$ — good number; $10$ and $50$ — nearly good numbers. 72 73 In the second test case: $208$ — good number; $169$ and $39$ — nearly good numbers. 74 75 In the third test case: $154$ — good number; $28$ and $182$ — nearly good numbers.