A. Kefa and First Steps
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th Day (1≤ i ≤ n) He makes ai -money . Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence a i. Let us remind you the subsegment of the sequence are its continuous fragment. A subsegment of numbers is called non-decreasing if all numbers on it follow in the non-decreasing order.
Help Kefa cope with this task!
Input
The first line contains integer n (1≤ n ≤105).
The second line contains n integers a1, a2, ..., C15>an (1≤ ai ≤109).
Output
Print a single integer-the length of the maximum non-decreasing subsegment of sequence a.
Sample Test (s) Input
6
2 2 1 3 4 1
Output
3
Input
3
2 2 9
Output
3
Note
In the first test the maximum non-decreasing subsegment are the numbers from the third to the fifth one.
In the second Test the maximum non-decreasing subsegment are the numbers from the first to the third one.
1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 intMain ()6 {7 inta[100005];8 intN;9scanf"%d",&n);Ten for(intI=0; i<n;i++) Onescanf"%d",&a[i]); A intans=0, maxn=1; - for(intI=1; i<n;i++) - if(a[i]>=a[i-1]) maxn++; the ElseAns=max (Maxn,ans), maxn=1; -ans=Max (Maxn,ans); -printf"%d\n", ans); - return 0; +}
Codeforces 580A Kefa and first Steps