#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5;
int main()
{
int a[N+5];
int n;
scanf("%d",&n);
for(int i=0; i<n; i++)
scanf("%d",&a[i]);
int ma=0;
int s=0;
for(int i=0; i<n-1; i++)
{
if(a[i]<a[i+1])
{
s++;
ma=max(ma,s);
}
else
s=0;
}
cout<<ma+1<<endl;
return 0;
}
本文介绍了一种求解最大连续上升子序列长度的方法,并提供了一个C++实现示例。通过对输入整数序列的遍历,算法能高效地找出最长递增子序列的长度。
382

被折叠的 条评论
为什么被折叠?



