codeforces#P2060A. Fibonacciness
Fibonacciness
Description
There is an array of $5$ integers. Initially, you only know $a_1,a_2,a_4,a_5$. You may set $a_3$ to any positive integer, negative integer, or zero. The Fibonacciness of the array is the number of integers $i$ ($1 \leq i \leq 3$) such that $a_{i+2}=a_i+a_{i+1}$. Find the maximum Fibonacciness over all integer values of $a_3$.
The first line contains an integer $t$ ($1 \leq t \leq 500$) — the number of test cases.
The only line of each test case contains four integers $a_1, a_2, a_4, a_5$ ($1 \leq a_i \leq 100$).
For each test case, output the maximum Fibonacciness on a new line.
Input
The first line contains an integer $t$ ($1 \leq t \leq 500$) — the number of test cases.
The only line of each test case contains four integers $a_1, a_2, a_4, a_5$ ($1 \leq a_i \leq 100$).
Output
For each test case, output the maximum Fibonacciness on a new line.
6
1 1 3 5
1 3 2 1
8 10 28 100
100 1 100 1
1 100 1 100
100 100 100 100
3
2
2
1
1
2
Note
In the first test case, we can set $a_3$ to $2$ to achieve the maximal Fibonacciness of $3$.
In the third test case, it can be shown that $2$ is the maximum Fibonacciness that can be achieved. This can be done by setting $a_3$ to $18$.