309098: CF1624B. Make AP
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Make AP
题意翻译
### 题目描述 $Polycarp$ 有 $3$ 个整数 $a,b,c$ 。你需要选择一个整数 $m$ ,使 $a,b,c$ 中的任意一个数乘上它,并让之后的 $a,b,c$ 构成[**算术级数**](https://en.wikipedia.org/wiki/Arithmetic_progression)。 - [**算术级数**](https://en.wikipedia.org/wiki/Arithmetic_progression):一个数列中每一组相邻的两个数的差相等(即为**等差数列**),如:$[5,10,15]$, $[3,2,1]$, $[1,1,1]$, $[13,10,7]$ 。而 $[1,2,4]$, $[0,1,0]$, $[1,3,2]$ 则不能形成[**算术级数**](https://en.wikipedia.org/wiki/Arithmetic_progression)。 ### 输入格式 第一行一个整数 $t$ $(1≤t≤10^4)$ 表示测试用例的数量。 之后 $t$ 行每一行是 $3$ 个整数 $a,b,c$ $(1≤a,b,c≤10 ^8)$ , 意义如题目描述中所示。 ### 输出格式 如果存在这样一个 $m$ , 输出 ```YES``` ,否则输出 ```NO``` (对 ```YES``` 和 ```NO``` 的大小写不做要求,如 ```YeS``` ```yeS``` 也是可以的)。题目描述
Polycarp has $ 3 $ positive integers $ a $ , $ b $ and $ c $ . He can perform the following operation exactly once. - Choose a positive integer $ m $ and multiply exactly one of the integers $ a $ , $ b $ or $ c $ by $ m $ . Can Polycarp make it so that after performing the operation, the sequence of three numbers $ a $ , $ b $ , $ c $ (in this order) forms an [arithmetic progression](https://en.wikipedia.org/wiki/Arithmetic_progression)? Note that you cannot change the order of $ a $ , $ b $ and $ c $ . Formally, a sequence $ x_1, x_2, \dots, x_n $ is called an arithmetic progression (AP) if there exists a number $ d $ (called "common difference") such that $ x_{i+1}=x_i+d $ for all $ i $ from $ 1 $ to $ n-1 $ . In this problem, $ n=3 $ . For example, the following sequences are AP: $ [5, 10, 15] $ , $ [3, 2, 1] $ , $ [1, 1, 1] $ , and $ [13, 10, 7] $ . The following sequences are not AP: $ [1, 2, 4] $ , $ [0, 1, 0] $ and $ [1, 3, 2] $ . You need to answer $ t $ independent test cases.输入输出格式
输入格式
The first line contains the number $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. Each of the following $ t $ lines contains $ 3 $ integers $ a $ , $ b $ , $ c $ ( $ 1 \le a, b, c \le 10^8 $ ).
输出格式
For each test case print "YES" (without quotes) if Polycarp can choose a positive integer $ m $ and multiply exactly one of the integers $ a $ , $ b $ or $ c $ by $ m $ to make $ [a, b, c] $ be an arithmetic progression. Print "NO" (without quotes) otherwise. You can print YES and NO in any (upper or lower) case (for example, the strings yEs, yes, Yes and YES will be recognized as a positive answer).
输入输出样例
输入样例 #1
11
10 5 30
30 5 10
1 2 3
1 6 3
2 6 3
1 1 1
1 1 2
1 1 3
1 100000000 1
2 1 1
1 2 2
输出样例 #1
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES