1 条题解
-
1
It's very easy. Let's watch the AC code!
#include<bits/stdc++.h> using namespace std; int n,a[10005],f[10005],ans; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); 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[j]<a[i]){ f[i]=max(f[i],f[j]+1); } } } for(int i=1;i<=n;i++){ ans=max(ans,f[i]); } cout<<ans; return 0; }If you have a better way to solve this problem, please let me know. We can learn from each other. Thanks!
- 1
信息
- ID
- 82
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- (无)
- 递交数
- 293
- 已通过
- 123
- 上传者