You are given a function that is similar to the Fibonacci series.
The function \(f\) is represented as follows:
\(f(1)=a,f(2)=b,f(i)=f(i-1)+f(i-2)\) for integer \(i\geq 3\)
You do not know the numbers that are available in the sequence. You are also given \(q\) queries. Each query contains a number \(x\). Your task is to determine whether a positive \(i^{th}\) integer satisfies \(f(i)=x\).
Input format
- First line: Two integers \(a,\ b\) (\(0\leq a,b\leq 10^{18}\))
- Second line: An integer \(q\) (\(0\leq q\leq 10^6\))
- Each of the \(q\) lines: An integer \(x_i\) (\(0\leq x_i\leq 10^{18}\))
Output format
Print the answer for each of the \(q\) queries in a new line. Therefore, the output must contain q lines. Print \(YES\) if there is an integer that satisfies the condition. Otherwise, print \(NO\).
F=1 1 2 3 5 8 13 21 ...
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor