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:空间一维的01背包,内详,转移方程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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator