实验题目:
编写一个程序exp5-2.cpp,求解背包问题:设有不同价值、不同重量的物品n件,求从这n件物品中选取一部分物品的方案,使选中物品的总重量不超过指定的限制重量,但选中物品的总价值最大。
源码:
#include<iostream>
#define Max 100
using namespace std;
struct bag
{
int weight;
int value;
};
int n;
int limweight;
int maxv;
int allvalue;
int setting[Max];
int cop[Max];
bag a[Max];
void find(