简单$dp$。
如果$a[i]>a[i-1]$,那么$dp[i]=dp[i-1]+1$。否则,$dp[i]=1$。答案为$dp[i]$中的最大值。
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<stack> #include<iostream> using namespace std; typedef long long LL; const double pi=acos(-1.0),eps=1e-8; void File() { freopen("D:\in.txt","r",stdin); freopen("D:\out.txt","w",stdout); } template <class T> inline void read(T &x) { char c = getchar(); x = 0;while(!isdigit(c)) c = getchar(); while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); } } const int maxn=100010; int a[maxn],dp[maxn],n,ans; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); dp[1]=1; ans=1; for(int i=2;i<=n;i++) { if(a[i]>a[i-1]) dp[i]=dp[i-1]+1; else dp[i]=1; ans=max(ans,dp[i]); } printf("%d ",ans); return 0; }