Created
November 11, 2016 03:54
-
-
Save tina1998612/2975819fd3288d679fdd4e34aca34c27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <cstdio> | |
#include <cstring> | |
#include <cstdlib> | |
#include <iostream> | |
#include <algorithm> | |
#define ll long long | |
#define N 100000+10 | |
using namespace std; | |
int n,a[N],cnt,k,fst,maxi; | |
int main(){ | |
cin>>n; | |
for(int i=0;i<n;i++) cin>>a[i]; | |
maxi=-1; | |
for(int i=0;i<n;i++) { | |
cnt=0; | |
k=0; | |
while(k<n) { | |
if(a[(i+k)%n]<=k) cnt++; | |
k++; | |
} | |
if(cnt>maxi){ | |
maxi=cnt; | |
fst=i; | |
} | |
} | |
cout<<fst+1<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment