Revenge of Fibonacci

Problem Description
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation
Fn = Fn-1 + Fn-2
with seed values F1 = 1; F2 = 1 (sequence A000045 in OEIS).
---Wikipedia

Today, Fibonacci takes revenge on you. Now the first two elements of Fibonacci sequence has been redefined as A and B. You have to check if C is in the new Fibonacci sequence.

Input
The first line contains a single integer T, indicating the number of test cases.

Each test case only contains three integers A, B and C.

[Technical Specification]
1. 1 <= T <= 100
2. 1 <= A, B, C <= 1 000 000 000

Output
For each test case, output “Yes” if C is in the new Fibonacci sequence, otherwise “No”.

Sample Input
3
2 3 5
2 3 6
2 2 110

Sample Output
Yes
No
Yes

http://blog.csdn.net/screaming/article/details/51078554

递推就可以了,利用递推式f[n]=f[n-1]+f[n-2]