Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define fast()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- fast();
- ll n,m=0,x=2,i;
- cin>>n;
- ll ara[n+1];
- for(i=0;i<n;i++)cin>>ara[i];
- for(i=2;i<n;i++)
- {
- if(ara[i-1]+ara[i-2]==ara[i])x++;
- else
- {
- m=max(m,x);
- x=2;
- }
- }
- m=max(m,x);
- if(n<=2)m=n;
- cout<<m<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement