0-1 背包问题
class Object {
friend int Knapsack(int*, int*, int, int, int*);
public:
int operator<=(Object a) const { return d >= a.d; }
private:
int ID;
float d;
};
template <class Typew, class Typep> class Knap;
class bbnode {
friend Knap<int, int>;
friend int Knapsack(int*, int*, int, int, int*);
private:
bbnode *parent;
bool LChild;
};
template <class Typew, class Typep>
class HeapNode {
friend Knap<Typew, Typep>;
public:
operator Typep() const { return uprofit; }
private:
Typep uprofit, profit;
Typew weight;
int level;
bbnode *ptr;
};
template
最后更新:
2024年1月14日 20:14:02
创建日期: 2024年1月2日 19:47:42
创建日期: 2024年1月2日 19:47:42