摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3631思路:由于只能用标记的点去更新,并且又要求任意两点之间的最短距离,显然floyd是最合适的。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<queue> 6 #include<vector> 7 using namespace std; 8 #define MAXN 333 9 #de 阅读全文
posted @ 2013-05-23 19:56 ihge2k 阅读(465) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3832思路:三次spfa求出1,2,3到各点的最短距离,然后枚举中间点到这三点的最短距离之和为ans,最后就是n-ans-1了。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<queue> 6 using namespace std; 7 #define MAXN 222 8 #define inf 1 阅读全文
posted @ 2013-05-23 17:46 ihge2k 阅读(243) 评论(0) 推荐(0) 编辑