爱嘉牛LA

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年12月15日

摘要: View Code #include<iostream>using namespace std;int n;float c;float bestv=0;float backknap(float w[],float v[],int bestx[],int x[],float sw,float sv,int t){ int j; float r; //剩余物品的总价值 if(t>=n){ if(sv>bestv){ //如果解比当前解更优 bestv=sv; fo... 阅读全文
posted @ 2012-12-15 16:00 爱嘉牛LA 阅读(432) 评论(0) 推荐(0) 编辑

摘要: 以下是C++类模版,存起来,以后想用,修改下就OKView Code template<class T>struct Node{ T data; //数据域,存放表元素 Node *next; //指针域,指向下一个节点};template<class T>class LinkList{private: Node<T>*Head;public: LinkList(); //构造函数 ~LinkList(); ... 阅读全文
posted @ 2012-12-15 15:58 爱嘉牛LA 阅读(213) 评论(0) 推荐(0) 编辑