www.pudn.com > bag.rar > BAG.C


#include "stdio.h" 
#define nn 100 
#define N 100 
double limitW,totV,maxv; 
int option[N],cop[N]; 
struct{ 
	double weight; 
	double value; 
	} a[N]; 
int n; 
try(int i,double tw,double tv) 
{ 
	int k; 
	if(tw+a[i].weight<=limitW) { 
		cop[i]=1; 
		if(imaxv) 
		if(i