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

请教背包算法问题的源代码,谢谢了

Posted by yu_ at 2007-04-27 22:41:26
假设输入为
m ,n
a[0],a[1],a[2].......a[n-1]

m为背包总重量的最大值(不可以超过,但可以等于)
n为 石头的数目
a[0]......a[n-1] 为每个石头的重量

写一个程序找出a数组的一部分数,使这些数尽量大,但不可以超过m
数组中每个数(石头)最多只可以取一次

输出第一行为取到的最大重量
第二行为该取的每个石头用空格分开

最好用C或C++

谁帮我写一下,谢谢了

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