FrWu_0212 @ 2024-11-17 08:48:41
#include<iostream>
#include<algorithm>
using namespace std;
void f(int a[],int n){
int dp[n+1]={};
fill(dp+1,dp+n+1,1);
for(int i=2;i<=n+1;i++){
for(int j=1;j<i;j++){
if(a[i]>a[j]&&dp[j]+1>dp[i]){
dp[i]=dp[j]+1;
}
}
}
int m=1;
for(int i=1;i<=n+1;i++){
m=max(m,dp[i]);
}
cout<<m;
}
int main(){
int n;
cin>>n;
int a[n+1]={};
for(int i=1;i<=n;i++){
cin>>a[i];
}
f(a,n);
return 0;
}
by OldDriverTree @ 2024-11-17 08:53:53
@FrWu_0212 循环不应该是到 n
吗(
by FrWu_0212 @ 2024-11-17 08:56:13
@OldDriverTree???
by OldDriverTree @ 2024-11-17 09:06:07
@FrWu_0212 你序列不是一共