Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int v[1001];
- int main ()
- {
- int n,i,contor=0;
- cin>>n;
- for(i=1; i<=n; i++)
- {
- cin>>v[i];
- }
- for(i=1; i<=n; i++)
- {
- if(v[i-1]+v[i+1]==v[i])
- {
- contor++;
- }
- }
- cout<<contor<<" ";
- return 0;
- }
Add Comment
Please, Sign In to add comment