[CodeForces 580A] Kefa and First Steps

题目链接:http://codeforces.com/problemset/problem/580/A

AC代码:

#include <iostream>
#include <cstdio>

using namespace std;

const int maxn = 100005;

int arr[maxn];
int n;

int main() {
    while(scanf("%d",&n) != EOF) {
        int maxans = 0,temp = 0;
        arr[0] = -1;
        for(int i = 1;i <= n;i++) {
            scanf("%d",&arr[i]);
            if(arr[i] >= arr[i-1]) {
                temp++;
                if(temp > maxans)
                    maxans = temp;
            } else {
                temp = 1;
            }
        }
        printf("%d\n",maxans);
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/youpeng/p/10952441.html