-
0
说明: 给定n种物品和一个背包,物品i的重量是Wi,价值是vi,被包容量是C,应该如何选择装入被包的物品,使得装入背包中物品的总价值最大?对于每种物品i,只有两种选择,装入或者不装入.
输入:第一行两个正整数n(物品数)和C(容量)
第二行n个正整数n,表示物品价值
第三行n个正整数n,表示物品重量
输出:第一行表示总价值
第二行n个数(0/1),0表示物品不装入,1表示装入
例如,
输入:
5 10
6 3 5 4 6
2 2 6 5 4
输出
15
1 1 0 0 1
(Species of a given n items and a backpack, the weight of item i is Wi, the value of vi, was packet capacity is C, should be how to choose a package of items to be loaded, the backpack load in the largest total value of goods? For each item i, there are only two options, loaded or not loaded. Input: the first line of the two positive integer n (the number of items) and C (capacity) of the second line of n positive integer n, that the value of the third line of n positive integer n, that the weight of output: the total value of the first line of the second line, said n number of (0/1), 0 that the items do not load, that load 1 for example, enter: 5,106,354,622 6 5 4 output 15 1 1 0 0 1)
- 2009-07-01 23:07:01下载
- 积分:1
-
greedyAlg
贪婪算法源程序。不只有Matlab程序,还有一些其他软件的。(Greedy algorithm source code. Not only the Matlab program, there are a number of other software.)
- 2011-05-25 17:42:44下载
- 积分:1
-
code
粒子群优化算法:是通过模拟鸟群觅食行为而发展起来的一种基于群体协作的随机搜索算法。(Particle Swarm Optimization)
- 2014-12-31 11:59:09下载
- 积分:1
-
zsy
cma算法的源代码,可仿真出图,还是不错的(cma algorithm source code, can be a simulation diagram, or good)
- 2009-03-24 23:12:59下载
- 积分:1
-
cruise_control
FMRLC Simulation Cruise Control
- 2010-08-21 22:50:49下载
- 积分:1
-
signal_compression2
运用matlab编写,可用于一维信号压缩,经验证应用效果较好。(Using matlab prepared for one-dimensional signal compression, proven applications better.)
- 2013-07-14 20:17:54下载
- 积分:1
-
eg17-guzhangzhengduan
《MATLAB神经网络30个案例分析》中的第17个例子,案例17 SOM神经网络的数据分类--柴油机故障诊断。希望对大家有一定的帮助!(The MATLAB neural network analysis of 30 cases of example, 17 cases of 17 SOM neural network data classification, diesel engine fault diagnosis. Hope to have certain help to everybody!
)
- 2013-09-20 16:32:54下载
- 积分:1
-
qcrv
应用小区域方差对比,程序简单,利用贝叶斯原理估计混合logit模型的参数,欢迎大家下载学习。( Application of small area variance comparison, simple procedures, Bayesian parameter estimation principle mixed logit model, Welcome to download the study.)
- 2016-04-15 11:33:50下载
- 积分:1
-
flametemperature
对传感器捕捉的火焰图像进行处理,得到温度分布的等值线(Calculation of flame temperature based on image processing
)
- 2021-04-15 13:48:54下载
- 积分:1
-
waveannprotected
this is face recognition system in matlab
- 2009-06-07 20:44:44下载
- 积分:1