czk111 @ 2023-07-18 22:33:13
#include <bits/stdc++.h>
using namespace std;
int a[5010];
int f[5010];
int n,m;
int main(){
cin>>n;
for(int i=1;i<=n;i++){cin>>a[i];f[i]=1;}
for(int i=1;i<=n;i++){
for(int j=1;j<i;j++){
if(a[i]>a[j])f[i]=max(f[i],f[j]+1);
}
}
cout<<f[n];
}
by SpeedStar @ 2023-07-18 23:09:31
@czk111 答案不一定是 f[n]
by Zq_water @ 2023-07-21 14:48:55
谢谢大佬回答,我也犯了同样的错误