上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页
摘要: 就是一个国际象棋的棋盘,可以八个方向走,问从起点到终点的最少步数是多少,还给出一个一个点是不可走的,简单的bfs#include#include#include#include#include#include using namespace std;int vis[1... 阅读全文
posted @ 2015-12-31 08:42 __NaCl 阅读(80) 评论(0) 推荐(0)
摘要: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=88791(题目连接)这道道题就是让你在大矩阵里找小矩阵,用矩阵hash用矩阵hash之前我们先定义下面这些玩意hash1[][]记录横列的的has... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(133) 评论(0) 推荐(0)
摘要: 建立哈弗曼树要求我们每次都选频率权值最小的点构成节点,即权值小的点在树的深处,权值大的点在树的浅处,根据节点选择的特点,我们可以把节点的值放在优先队列中,包括新形成的节点。我们先定义优先队列的优先级别。1 struct cmp2 {3 bool operator... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(114) 评论(0) 推荐(0)
摘要: Kruskal算法的过程:(1) 将全部边按照权值由小到大排序。 (2) 按顺序(边权由小到大的顺序)考虑没条边,只要这条边和我们已经选择的边步构成圈,就保留这条边,否则放弃这条边。算法 成功选择(n-1)条边后,形成一个棵最小生成树,当然如果算法无法选择出(n-1)... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(366) 评论(0) 推荐(0)
摘要: 对于背包问题,网上有很多博客= =,如果有不小心点进来的朋友,看到我挫逼的博文然后看不懂,可以自行百度一篇,其中本文的博文内 容参照 http://blog.csdn.net/lyhvoyage/article/details/8545852#0-qzone-1-46291-d020d2d2a4e8... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(67) 评论(0) 推荐(0)
摘要: 1:最大公约数的求法欧几里得算法实现。递归实现 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 __int64 gcd(__int64 y,__int64 x) 7 { 8 ... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(127) 评论(0) 推荐(0)
摘要: Your current task is to make a ground plan for a residential building located in HZXJHS. So you must determine a way to split the floor building wit... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(118) 评论(0) 推荐(0)
摘要: DescriptionMany people like to solve hard puzzles some of which may lead them to madness. One such puzzle could be finding a hidden prime number in a ... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(81) 评论(0) 推荐(0)
摘要: Problem DescriptionThere are n apple trees planted along a cyclic road, which is L metres long. Your storehouse is built at position 0 on that cyclic ... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(89) 评论(0) 推荐(0)
摘要: 题目链接http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1279这道题要求的就是当顶被封之前有多少盘被扔下去= =当顶被封住时 即使下面的盘子再小也不能扔下去我们用a[]保存井的宽度,数组b[... 阅读全文
posted @ 2015-12-31 08:41 __NaCl 阅读(94) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页