Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:那位大神帮看下,哪错了???In Reply To:那位大神帮看下,哪错了??? Posted by:yanlu521521 at 2011-08-06 21:03:51 #include <iostream> #include <cstdio> #include <cstring> using namespace std; int Num[1002]; int DP[1002]; int main() { int Cases, Max; while( cin >> Cases ) { memset(DP,0,sizeof(DP)); for( int i=1; i<=Cases; ++i ) scanf("%d",Num+i); Max=0; for(int i = 1;i <=Cases;i++) DP[i] = 1; for( int i=1; i<=Cases; ++i ) { for( int j=1; j<i; ++j ) if( Num[i] > Num[j] && DP[j]>=DP[i]) DP[i] = DP[j]+1; if( Max < DP[i] ) Max = DP[i]; } printf("%d\n",Max); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator