Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:那位大神帮看下,哪错了???

Posted by 900629 at 2011-08-16 10:21:22 on Problem 2533
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 i , j ;
int main()
{
    int Cases, Max;
    while( cin >> Cases )
    {
        memset(DP,0,sizeof(DP));
        for(  i=1; i<=Cases; ++i )
              { scanf("%d",Num+i); DP[i]=1;}
      Max=0;
      
      for(  i=1; i<=Cases; ++i )
      {
        for( 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator