C++
#include<iostream>
using namespace std;
int main(){
int n, v[1001];
cin>>n;
for(int i=1;i<=n;i++) cin>>v[i];
for(int i=2;i<=n-1;i++) {if(v[i]==(v[i-1]+v[i+1])/2) cout<<i; break;}
}
PSEUDOCOD
citeste n
|-pentru i<-1,n executa
| citeste v[i]
|-
|-pentru i<-2,n-1 executa
| |-daca v[i]=(v[i-1]+v[i+1])/2 atunci
| | scrie i
| |-
| break
|-