标签:
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1257
#include <cmath> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1000+10; #define inf 0x3f3f3f3f #define met(a,b) memset(a,b,sizeof(a)) int dp[maxn]; int main() { int n; while(scanf("%d",&n)!=EOF) { met(dp,0); int i,j,l=0; dp[1]=inf; for(i=1;i<=n;i++) { int num; scanf("%d",&num); for(j=1;j<=l;j++) { if(dp[j]>num) { dp[j]=num; break; } } if(j>l) dp[++l]=num; } printf("%d\n",l); } }
标签:
原文地址:http://www.cnblogs.com/TAT1122/p/5860232.html