資源簡介
使用貪心算法解決多重背包問題(物體可拆分)的具體C++代碼
代碼片段和文件信息
#include?
#include?
using?namespace?std;?
struct?good
{?
double?p;?
double?w;
double?r;
}
a[2000];?
double?svaluem;?
int?in;?
bool?bigger(good?agood?b)?
{?
return?a.r>b.r;?
}?
int?main()?
{?
cout<<“Input?n(count?of?goods)?and?m(total?weight):“< cin>>n>>m;
cout<<“Input?weight
- 上一篇:Logistic回歸C語言實現
- 下一篇:行人檢測C++代碼
評論
共有 條評論