Skip to content

Instantly share code, notes, and snippets.

@pazthor
Last active October 15, 2015 20:58
Show Gist options
  • Save pazthor/cb5d71a62708e54405dd to your computer and use it in GitHub Desktop.
Save pazthor/cb5d71a62708e54405dd to your computer and use it in GitHub Desktop.
/*
*
*Link to problem http://codeforces.com/contest/580/problem/A
*
*solution official : http://codeforces.com/blog/entry/20468
*The next code, was my implementation for the problem.
*/
#include<stdio.h>
int array[100003];
int main(){
int n,i,max,count;
scanf("%d",&n);
for( i =0; i< n; i++)
scanf("%d", &array[i]);
max = count =1;
for(i =1; i < n ; i++){
if(array[i] >= array[i-1])
count++;
else if(max < count){
max = count;
count =1;
}else count =1;
}
if(max < count) max = count;
printf("%d",max);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment