摘要: 算法描述: 活结点优先队列中结点元素N的优先级由该结点的上界函数Bound计算出的值uprofit给出。 子集树中以结点N为根的子树中任一结点的价值不超过N.profit。 可用一个最大堆来实现或节点优先队列。 N.weight 是结点N所相应的重量,N.profit是N所相应的价值,N.uprofit是结点N的价值上界,最大堆以这个值作为优先级。class Object{ friend int Knapsack(int *,int *,int ,int ,int *);public: int operator <= (Object a) const { ... 阅读全文
posted @ 2012-11-07 16:38 xingoo 阅读(1171) 评论(2) 推荐(1)
摘要: 语法:mult(charc[],chart[],intm);参数: c[]: 被乘数,用字符串表示,位数不限 t[]: 结果,用字符串表示 m: 乘数,限定10以内返回值: null注意: 需要string.h源程序: #include <stdio.h>#include <stdlib.h>#include <string.h>void mult(char c[],char t[],int m){ int i,l,k,flag,add=0; char s[100]; l=strlen(c); for (i=0;i<l;i++) s[l-i-1]=.. 阅读全文
posted @ 2012-11-07 10:59 xingoo 阅读(521) 评论(0) 推荐(0)