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

第一个自己独立解决的DP问题,不容易啊,说说思路

Posted by AB38017032 at 2012-08-02 10:44:50 on Problem 1050
从一维数组括展到二维数组
一维数组:
#define min -999999
sum=0;
maxsum=min;
for(b=j=0;j<N;j++)
{
    scanf("%d",&x);
    sum+=x;
    if(sum>maxsum)
    {
         maxsum=sum;
         start=b;
         end=j;
     }
     if(sum<0)
     {
        sum=0;
        b=j+1;
     }

本题二维数组,可以分成有i行(i从1到n)
再根据一维数组做

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