摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1874思路分析:该问题给定一个无向图、起始点和终点,要求求出从起始点到终点的最短距离;使用Dijkstra算法求出从起始点到所有的其他点的最短路长度即可,如果最短路长度为INT_MAX,表示从起始点到该点... 阅读全文
posted @ 2015-07-26 17:00 Leptus 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544思路分析:该问题给定一个无向图,要求求从起始点到终点的最短路径长度;可以使用dijkstra算法求出该起始点到其他所有点的最短距离;代码如下:#include #include #include #... 阅读全文
posted @ 2015-07-26 16:25 Leptus 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1233思路分析:该问题为最小生成树问题,使用kruskal算法或者prim算法即可解决;代码如下:#include #include #include #include using namespace s... 阅读全文
posted @ 2015-07-26 12:33 Leptus 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5311思路分析:该问题要求在字符串中是否存在三个不相交的子串s[l1..r1], s[l2..r2], s[l3..r3]能够拼接成模式串,而且满足要求1≤l1≤r1#include #include u... 阅读全文
posted @ 2015-07-26 00:10 Leptus 阅读(160) 评论(0) 推荐(0) 编辑