摘要:
这题还是最小生成树 ==已经修建的道路的权值位0,然后再用克鲁斯卡尔算法#include#include#includeusing namespace std;const int maxn=2000;int p[maxn];struct node{ int u,... 阅读全文
posted @ 2015-12-31 08:43
__NaCl
阅读(96)
评论(0)
推荐(0)
摘要:
这题是要你求讲所有点连起来的最小的代价是多少。连起两点的代价是两个点之间的距离。。。最基本的最小生成树#include#include#include #include#includeusing namespace std;const int maxn=200;int... 阅读全文
posted @ 2015-12-31 08:43
__NaCl
阅读(209)
评论(0)
推荐(0)
摘要:
这是一道关于拓扑排序的题,并且要输出其中一种拓扑序列#include#include#include#includeusing namespace std;const int maxn=150;int c[maxn];int topo[maxn],t;int G[ma... 阅读全文
posted @ 2015-12-31 08:43
__NaCl
阅读(99)
评论(0)
推荐(0)
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1221这道题前19行给出城市的联通关系比如1 3 2 3 4 3 4 5 6 1 6 1 7 2 12 13 1 8 ... 阅读全文
posted @ 2015-12-31 08:43
__NaCl
阅读(98)
评论(0)
推荐(0)
摘要:
二叉排序树是一种左子树的值小于根,而右子树的值大于根的的一棵树,通过中序遍历可以得到一个有序的序列= =#include#include#include#include#includeusing namespace std;typedef struct node{ ... 阅读全文
posted @ 2015-12-31 08:43
__NaCl
阅读(122)
评论(0)
推荐(0)
摘要:
这两道题都是和欧拉图的判定有关,一个是有向图,一个是无向图的欧拉图的判定还有一个是有向图= =先看10129。。。我们把单词的首字母看做是入度,最后一个字符看做是初度,那么这道题就变成图中是否存在欧拉回路。判断有向图的条件是该图是连通图和最多最有两个点的出度不等于入度... 阅读全文
posted @ 2015-12-31 08:43
__NaCl
阅读(196)
评论(0)
推荐(0)
摘要:
这题其实很简单的说,第一次用邻接表来存图= =首先图的储存结构是结构体+head数组。。。其实head数组保存的struct node{ int v; int next;}V[200*200]; 假设现在有u节点,v表示的是和他邻接的点,next保存的是v... 阅读全文
posted @ 2015-12-31 08:42
__NaCl
阅读(122)
评论(0)
推荐(0)
摘要:
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1498题意的意思是给你n个房间,每个房间有一个价值,每个房间可以通向一些其... 阅读全文
posted @ 2015-12-31 08:42
__NaCl
阅读(114)
评论(0)
推荐(0)
摘要:
原题链接http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1126这题我们应该先求出他的周期来。。。。。 for(i=3;i#include#include#includeusing names... 阅读全文
posted @ 2015-12-31 08:42
__NaCl
阅读(93)
评论(0)
推荐(0)
摘要:
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5400这题其实就是求有多少公差为d1和公差为d2的等差序列和前半段是公差为d1后半段的公差为d2的序列。。。。。我们可以用个b数组保存序列中相邻两项的和,然后直接查找b数组... 阅读全文
posted @ 2015-12-31 08:42
__NaCl
阅读(142)
评论(0)
推荐(0)

浙公网安备 33010602011771号