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 422803902 at 2013-01-30 22:08:18 on Problem 1014 and last updated at 2013-01-30 22:10:00
In Reply To:多重背包,16MS过。以下是思想及代码! Posted by:qihongqi at 2012-12-25 17:43:32
我觉得这个有缺陷,就是在01背包的那一部分。如果像你这样分解物品的话可能会有错:比如某物品有6个,你有可能会使用了7个;而如果某物品有2个,你只会使用1个。
应该分解成1、2……2^(k-1)、n[i]-2^k,其中n[i]-2^k>=0.这样使用的物品数不会超过n[i].

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