简单DP
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1257
View Code
1 #include <stdio.h> 2 #define M 100000 3 int x[M],y[M]; 4 int main() 5 { 6 int n,i,j,c; 7 y[0]=0; 8 while(scanf("%d",&n)!=EOF) 9 { 10 c=0; 11 for(i=0;i<n;i++) 12 { 13 scanf("%d",&x[i]); 14 for(j=0;j<c;j++) 15 { 16 if(x[i]<y[j]) { y[j]=x[i];break;} 17 } 18 if(j==c) {y[c]=x[i];c++;} 19 } 20 printf("%d\n",c); 21 } 22 return 0; 23 }