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

题目是0-1背包变式,网上的代码几乎都是用完全背包然后降维写的

Posted by seh631638554 at 2019-12-05 13:10:28 on Problem 1015
每个只能取1次,m就是背包大小,n就是个数,k是另外维护的数据,按照0-1来写优化降维的转移方程,外层for应该是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