Codeforces Round 213 (Div. 2)
B
The Fibonacci Segment
Codeforces
1100
原题
← AC →
翻译中…

You have array $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. Segment $[*l*, *r*]$ ($1 ≤ *l* ≤ *r* ≤ *n*$) is good if $*a*_{*i*} = *a*_{*i* - 1} + *a*_{*i* - 2}$, for all $*i*$ $(*l* + 2 ≤ *i* ≤ *r*)$.

翻译中…

Let's define $*len*([*l*, *r*]) = *r* - *l* + 1$, $*len*([*l*, *r*])$ is the length of the segment $[*l*, *r*]$. Segment $[*l*_{1}, *r*_{1}]$, is longer than segment $[*l*_{2}, *r*_{2}]$, if $*len*([*l*_{1}, *r*_{1}]) > *len*([*l*_{2}, *r*_{2}])$.

翻译中…

Your task is to find a good segment of the maximum length in array $*a*$. Note that a segment of length $1$ or $2$ is always good.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the number of elements in the array. The second line contains integers: $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($0 ≤ *a*_{*i*} ≤ 10^{9}$).

翻译中…

Output

翻译中…

Print the length of the longest good segment in array $*a*$.

翻译中…

样例

Input #1
10
1 2 3 5 8 13 21 34 55 89
Output #1
10
InputCopy OutputCopy
Input #2
5
1 1 1 1 1
Output #2
2
InputCopy OutputCopy
题目信息
题号
365B
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。