标签:
#include <cstdio>
#include <algorithm>
using namespace std;
int dp[1000 + 10],a[1000 + 10];
int main(){
int n;
while(~scanf("%d",&n)){
for(int i = 1;i <= n ; ++i){
scanf("%d",&a[i]);
}
for(int i = 1;i <= n ;++i){
dp[i] = 1;
for(int j = 1;j < i ; ++j){
if(a[j] < a[i]){
dp[i] = max(dp[i],dp[j] + 1);
}
}
}
int ans= 0;
for(int i = 1;i <= n;++i){
ans = max(ans,dp[i]);
}
printf("%d\n",ans);
}
return 0;
}
[2016-04-01][poj][2533][Longest Ordered Subsequence]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/37751ee93c89508e8c1c74425e71c367.html