上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: /* theme:八皇后 回溯算法 coder:瞿鹏志 time:2015.1.11 */#include using namespace std;#define N 15#define M 8class Eight_Queen{ private: i... 阅读全文
posted @ 2015-01-11 13:20 机智的程序员小熊 阅读(105) 评论(0) 推荐(0) 编辑
摘要: /* 素数的筛选找法 coder:qpz time:2014-12-15*/ #include #include void Init(char *a,int n){ inti; for(i=0;i<n;i++){ ... 阅读全文
posted @ 2014-12-18 00:58 机智的程序员小熊 阅读(101) 评论(0) 推荐(0) 编辑
摘要: /*1/1 + 1/2 + 1/3+ 1/4 + ... 在数学上称为调和级数。 它是发散的,也就是说,只要加上足够多的项,就可以得到任意大的数字。 但是,它发散的很慢: 前1项和达到 1.0前4项和才超过 2.0前83项的和才超过 5.0 那么,请你计算一下,要加多... 阅读全文
posted @ 2014-12-18 00:56 机智的程序员小熊 阅读(462) 评论(0) 推荐(0) 编辑
摘要: /*字典搜索问题描述:给定一个字典,有若干个单词,每个单词不超过6个字母,以****作为输入结束 要求:输入一堆乱序字母作为输入单词,比较字典中的字母,如果输入的单词经过排列组合可以与字典中的单词匹配,则输出(如果和多个单词匹配,从小到大输出)如果字典单词无匹配,输出... 阅读全文
posted @ 2014-12-18 00:55 机智的程序员小熊 阅读(89) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#include #include typedef struct { char data; int weight; int left; int right; int parents; int code;}Huf... 阅读全文
posted @ 2014-12-15 21:06 机智的程序员小熊 阅读(137) 评论(0) 推荐(0) 编辑
摘要: /* 归并排序实现 coder:QPZ time:2014-12-03*/#include #include #include using namespace std;class Mergesort{ private: ... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(81) 评论(0) 推荐(0) 编辑
摘要: /* 例如,对于数列{pi}={5,3, 8, 2, 9},Huffman树的构造过程如下: 1. 找到{5, 3, 8, 2, 9}中最小的两个数,分别是2和3,从{pi}中删除它们并将和5加入,得到{5, 8, 9, 5},费用为5。 2. 找到... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(83) 评论(0) 推荐(0) 编辑
摘要: /* 快速排序的实现 coder:QPZ time:2014-12-04*/#include #include #include using namespace std;#define N 10void Swap(int &a,int &b){ int t; t... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(109) 评论(0) 推荐(0) 编辑
摘要: srand函数是随机数发生器的初始化函数。原型:void srand(unsigned seed);用法:它需要提供一个种子,这个种子会对应一个随机数,如果使用相同的种子后面的rand()函数会出现一样的随机数。如: srand(1); 直接使用1来初始化种子。不过为... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(239) 评论(0) 推荐(0) 编辑
摘要: /* * 装箱问题 * 算法:贪婪 * coder:瞿鹏志 * time:2014-11-29 */#include #include using namespace std;#define MAX 20/*第一步:创建物品字典 */ typ... 阅读全文
posted @ 2014-12-15 20:57 机智的程序员小熊 阅读(184) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页