hoj1288 Bridging Signals
http://acm.hit.edu.cn/hoj/problem/view?id=1288
dp,最长数字序列问题,f[i]记为序列长度为i的最小数字
/*This Code is Submitted by billforum for Problem 1288 at 2012-02-02 10:47:48*/ #include <iostream> using namespace std; int main(int args,char** argv) { int n,j; int np,ans,p[40001],f[40001]; cin>>n; while(n--) { cin>>np; ans=0; for(int i=0;i<np;i++) cin>>p[i]; f[0]=0; j=0; for(int i=0;i<np;i++) { int num=p[i],k; for(k=j;k>=0;k--) { if(num>f[k]) { f[++k]=num; break; }//if }//for if(k>j) j=k; }//for cout<<j<<endl; }//while return 0; }