CF1612D.X-Magic Pair
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a pair of integers (a,b) and an integer x .
You can change the pair in two different ways:
- set (assign) a:=∣a−b∣ ;
- set (assign) b:=∣a−b∣ ,
where ∣a−b∣ is the absolute difference between a and b .The pair (a,b) is called x -magic if x is obtainable either as a or as b using only the given operations (i.e. the pair (a,b) is x -magic if a=x or b=x after some number of operations applied). You can apply the operations any number of times (even zero).
Your task is to find out if the pair (a,b) is x -magic or not.
You have to answer t independent test cases.
输入格式
The first line of the input contains one integer t ( 1≤t≤104 ) — the number of test cases. The next t lines describe test cases.
The only line of the test case contains three integers a , b and x ( 1≤a,b,x≤1018 ).
输出格式
For the i -th test case, print YES if the corresponding pair (a,b) is x -magic and NO otherwise.
输入输出样例
输入#1
8 6 9 3 15 38 7 18 8 8 30 30 30 40 50 90 24 28 20 365 216 52 537037812705867558 338887693834423551 3199921013340
输出#1
YES YES YES YES NO YES YES YES