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 zhaomingming at 2011-12-08 00:53:45 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 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:
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