02 2015 档案

摘要:Problem DescriptionThere is a permutation without two numbers in it, and now you know what numbers the permutation has. Please find the two numbers it... 阅读全文
posted @ 2015-02-07 17:10 我喜欢旅行 阅读(168) 评论(0) 推荐(0)
摘要:#1062 : 最近公共祖先·一时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Ho最近发现了一个神奇的网站!虽然还不够像58同城那样神奇,但这个网站仍然让小Ho乐在其中,但这是为什么呢?“为什么呢?”小Hi如是问道,在他的观察中小Ho已经沉迷这个网站一周之久了,甚至连他心爱... 阅读全文
posted @ 2015-02-07 09:29 我喜欢旅行 阅读(220) 评论(0) 推荐(0)
摘要:滑雪Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 79519Accepted: 29581DescriptionMichael 喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你... 阅读全文
posted @ 2015-02-06 14:31 我喜欢旅行 阅读(254) 评论(0) 推荐(0)
摘要://---基于邻接表的bfs #include #include #include #include #include #include using namespace std; struct node { int date; struct node *next; ... 阅读全文
posted @ 2015-02-05 20:54 我喜欢旅行 阅读(141) 评论(0) 推荐(0)
摘要://模板 头文件 宏定义...#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2015-02-05 19:57 我喜欢旅行 阅读(160) 评论(0) 推荐(0)
摘要:转载地址:http://blog.csdn.net/wuxuguang123/article/details/8130081一 个程序的功能通常有很多种方法来实现,怎么样的程序才算得上最优呢?举个例子,如果实现同一个功能的两个程序,一个一点按钮就给出运行结果,而另一个则需 要漫长的时间去等待,就像安... 阅读全文
posted @ 2015-02-05 08:22 我喜欢旅行 阅读(289) 评论(0) 推荐(0)
摘要:1.Dijkstra算法:(计算正权图上的单源最短路 single-sourceshortest paths (sssp) )从单个节点出发到所有节点的最短路。复杂度:O(n*n)该算法适用于:有向图和无向图。1). O(n^2)的实现:邻接矩阵map存储实现,INF表示无穷大void Dijkst... 阅读全文
posted @ 2015-02-04 14:46 我喜欢旅行 阅读(316) 评论(0) 推荐(0)
摘要:转载地址:http://blog.csdn.net/nike0good/article/details/43449739B. Painting Pebblestime limit per test1 secondmemory limit per test256 megabytesinputstand... 阅读全文
posted @ 2015-02-04 13:42 我喜欢旅行 阅读(321) 评论(0) 推荐(0)
摘要:转载地址:http://blog.csdn.net/acdreamers/article/details/16902023我们首先来看一下什么是前向星.前向星是一种特殊的边集数组,我们把边集数组中的每一条边按照起点从小到大排序,如果起点相同就按照终点从小到大排序,并记录下以某个点为起点的所有边在数组... 阅读全文
posted @ 2015-02-03 20:12 我喜欢旅行 阅读(210) 评论(0) 推荐(0)
摘要:转载地址:http://blog.csdn.net/acdreamers/article/details/9989197首先来说说三分的概念:二分是把区间分为长度相等的两段,三分则是把区间分为长度相等的三段,进行查找,这样的查找称为三分查找,三分查找通常用来迅速确定最值。众所周知,二分算法的要求是搜... 阅读全文
posted @ 2015-02-03 20:08 我喜欢旅行 阅读(1815) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #define N 100000+2using namespace std;//无根树转有根树算法/* 算法分析:所谓无根树,就是根节点任意的树。我们可以给它确定一个根节点。 我们可以假定认为某一个节点为根... 阅读全文
posted @ 2015-02-03 19:33 我喜欢旅行 阅读(948) 评论(0) 推荐(0)
摘要:#1050 : 树中的最长路时间限制:10000ms单点时限:1000ms内存限制:256MB描述上回说到,小Ho得到了一棵二叉树玩具,这个玩具是由小球和木棍连接起来的,而在拆拼它的过程中,小Ho发现他不仅仅可以拼凑成一棵二叉树!还可以拼凑成一棵多叉树——好吧,其实就是更为平常的树而已。但是不管怎么... 阅读全文
posted @ 2015-02-03 08:54 我喜欢旅行 阅读(1222) 评论(0) 推荐(0)
摘要:两次DFS求树中的最长路。基于邻接矩阵:代码:#include #include #include #include #include #include using namespace std;bool map[10001][10001];int n;int tail;bool vis[1001];... 阅读全文
posted @ 2015-02-02 19:45 我喜欢旅行 阅读(304) 评论(0) 推荐(0)
摘要:路线冲突问题题目描述给出一张地图,地图上有n个点,任意两点之间有且仅有一条路。点的编号从1到n。现在兵团A要从s1到e1,兵团B要从s2到e2,问两条路线是否会有交点,若有则输出交点个数,否出输出”success”。输入多组输入。对于每组输入。第一行输入n(1#include #include #i... 阅读全文
posted @ 2015-02-02 15:26 我喜欢旅行 阅读(359) 评论(0) 推荐(0)
摘要:Black and white painting题目描述You are visiting the Centre Pompidou which contains a lot of modern paintings. In particular you notice one painting which... 阅读全文
posted @ 2015-02-02 08:53 我喜欢旅行 阅读(286) 评论(0) 推荐(0)
摘要:Annoying painting tool题目描述Maybe you wonder what an annoying painting tool is? First of all, the painting tool we speak of supports only black and whit... 阅读全文
posted @ 2015-02-02 08:24 我喜欢旅行 阅读(328) 评论(0) 推荐(0)