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:竟然让一个普通的多重背包用了18xx秒很顺利地过了

Posted by endkiller at 2010-10-04 00:15:21 on Problem 1742
In Reply To:竟然让一个普通的多重背包用了18xx秒很顺利地过了 Posted by:fanhqme at 2009-06-08 18:58:29
> 设dp[i][j]为用前i种钱币,最少使用多少个第i种钱币的情况下可以凑出j个单位的钱。
> 
> 加上一个滚动数组
> 
> if (dp[j]!=-1)dp[j]=0;
> else if (j>=A[i] && dp[j-A[i]]!=-1 && dp[j-A[i]]<C[i])dp[j]=dp[j-A[i]]+1;
> else dp[j]=-1;
> 
这种方法不过就没天理了,大多数人都是这种方法吧

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