-
时间:2016-03-23 13:04:56 星期三
-
题目编号:[2016-03-23][codeforces][580][A][Kefa and First Steps]
-
题目大意:求最长上升子串
#include <cstdio>
using namespace std;
int a[100000 + 100];
int main(){
int n;
scanf("%d",&n);
for(int i = 0 ;i < n ;++i)
scanf("%d",&a[i]);
int cur = 1,ans = 0;
for(int i = 1;i < n ;++i){
if(a[i] >= a[i - 1]) ++cur;
else{
if(ans < cur) ans = cur;
cur = 1;
}
}
printf("%d\n", cur>ans?cur:ans);
return 0;
}
时间: 2024-08-14 04:17:40