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:空间一维的01背包,内详,转移方程

Posted by bmy at 2010-08-16 00:25:15 on Problem 2184
In Reply To:空间一维的01背包,内详,转移方程 Posted by:lqp18_31 at 2009-07-28 14:12:14
>     for( int i=1 ; i<=N;  i++)
>     {
>          if( a[ i ]>0 )
>          for( int j=MAX-1 ; j>=a[ i ] ; j--)  
>              f[ j ]=max( f[ j ] , f[ j-a[ i ] ]+b[ i ] );
>          else{
>               a[ i ]=-a[ i ];
>               for( int j=0 ; j+a[ i ]<MAX ; j++)
>                 f[ j ]=max( f[ j ] , f[ j+a[ i ] ]+b[ i ] );
>          }
>     }
> 
> best=max( f[ i ]+i-MID , best );
MAX是什么意思?

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