09 2015 档案

摘要:这题还是最小生成树 ==已经修建的道路的权值位0,然后再用克鲁斯卡尔算法#include#include#includeusing namespace std;const int maxn=2000;int p[maxn];struct node{ int u,v,w;};bool cmp(n... 阅读全文
posted @ 2015-09-30 22:20 __NaCl 阅读(125) 评论(0) 推荐(0)
摘要:这题是要你求讲所有点连起来的最小的代价是多少。连起两点的代价是两个点之间的距离。。。最基本的最小生成树#include#include#include #include#includeusing namespace std;const int maxn=200;int u[maxn*maxn],v[... 阅读全文
posted @ 2015-09-22 17:36 __NaCl 阅读(112) 评论(0) 推荐(0)
摘要:这是一道关于拓扑排序的题,并且要输出其中一种拓扑序列#include#include#include#includeusing namespace std;const int maxn=150;int c[maxn];int topo[maxn],t;int G[maxn][maxn];int n,... 阅读全文
posted @ 2015-09-22 14:10 __NaCl 阅读(214) 评论(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 2 9 10 1 11 1 11 2 ... 阅读全文
posted @ 2015-09-19 11:34 __NaCl 阅读(201) 评论(0) 推荐(0)
摘要:二叉排序树是一种左子树的值小于根,而右子树的值大于根的的一棵树,通过中序遍历可以得到一个有序的序列= =#include#include#include#include#includeusing namespace std;typedef struct node{ int data; s... 阅读全文
posted @ 2015-09-15 21:12 __NaCl 阅读(179) 评论(0) 推荐(0)
摘要:这两道题都是和欧拉图的判定有关,一个是有向图,一个是无向图的欧拉图的判定还有一个是有向图= =先看10129。。。我们把单词的首字母看做是入度,最后一个字符看做是初度,那么这道题就变成图中是否存在欧拉回路。判断有向图的条件是该图是连通图和最多最有两个点的出度不等于入度,其实那两个点就是起点和终点,而... 阅读全文
posted @ 2015-09-12 17:41 __NaCl 阅读(190) 评论(0) 推荐(0)
摘要:这题其实很简单的说,第一次用邻接表来存图= =首先图的储存结构是结构体+head数组。。。其实head数组保存的struct node{ int v; int next;}V[200*200];假设现在有u节点,v表示的是和他邻接的点,next保存的是v对应的编号,head数组保存的是链... 阅读全文
posted @ 2015-09-10 18:23 __NaCl 阅读(252) 评论(0) 推荐(0)
摘要:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1498题意的意思是给你n个房间,每个房间有一个价值,每个房间可以通向一些其他的房间,然后每个房间可以访问多... 阅读全文
posted @ 2015-09-08 17:12 __NaCl 阅读(176) 评论(0) 推荐(0)
摘要:Slash MazeBy filling a rectangle with slashes (/) and backslashes ( ), you can generate nice little mazes. Here is an example:As you can see, paths ... 阅读全文
posted @ 2015-09-06 22:09 __NaCl 阅读(136) 评论(0) 推荐(0)
摘要:题目链接https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=473= =这题就是就是给你一个三维的图,然后给你一个起点,一个终点,中间有障碍= =问你是否能够从... 阅读全文
posted @ 2015-09-06 21:55 __NaCl 阅读(228) 评论(0) 推荐(0)
摘要:原题链接https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=598这题就是在一堆*里找X,相邻的X算一个,所以我们可以两次dfs搜索,dfs2搜*有多少堆,df... 阅读全文
posted @ 2015-09-04 22:44 __NaCl 阅读(179) 评论(0) 推荐(0)
摘要:B. Bear and Three Musketeerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDo you know a story ... 阅读全文
posted @ 2015-09-01 22:16 __NaCl 阅读(307) 评论(0) 推荐(0)
摘要:原题链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1092这题其实可以把字符串str反转一下然后再求两个字符串的最长公共子序列的长度,然后len(str)-那个长度就是答案了= =#include#include#i... 阅读全文
posted @ 2015-09-01 22:07 __NaCl 阅读(121) 评论(0) 推荐(0)