
ACM_最短路
文章平均质量分 81
ACM_sjtsjt
不忘初心 追求美好
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu 3416 spfa+sap
1.spfa计算出最短路 2.如果是最短路上的边的话 uv之间建一条容量为1的边 dist[v]=dist[u]+cost[u][v]就能说明uv是最短路上的一条边 3.跑一边sap #include #include #include #include #include using namespace std; const int MAXN=2222; const int MAXM=333原创 2016-05-14 18:48:31 · 278 阅读 · 0 评论 -
hdu 4571 Travel in time(floyd+dp)
链接http://acm.hdu.edu.cn/showproblem.php?pid=4571 距离上的cost用floyd算 是否停留用dp求 最后遍历dp[i][j]搜索答案 #include #include #include using namespace std; typedef struct { int c,s,num; }Point; int g[105][105]原创 2016-03-21 23:35:43 · 416 阅读 · 0 评论 -
hdu 1535 Invitation Cards(邻接表spfa)
Invitation Cards Problem Description In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater原创 2016-02-17 23:42:14 · 542 阅读 · 0 评论 -
hdoj 1385 Minimum Transport Cost(floyd 记录最短路径)
Minimum Transport Cost Problem Description These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be del原创 2016-02-05 04:57:39 · 294 阅读 · 0 评论 -
hdoj 3790 最短路径问题(根据两个变量的最短路)
多加一个判断就好- -#include #include #include using namespace std; const int N = 1000 + 10; const int MAX = 0xfffffff; int map[N][N], cost[N][N]; int min_dist, min_cost; void Dijkstra(int s, int t, int n)原创 2016-02-04 22:51:08 · 416 阅读 · 0 评论 -
hdu 检测赛(最短路中途必须经过两个点)
Problem G 没做过这样的题目完全没思路 Problem Description 给定n个点,m条无向边,1为起点,求从起点出发,至少经过两个点(非起点)并且回到最终回到起点的最短路(中途可以经过起点) 点的编号为1到n Input 多组用例 每个用例的第一行是2个整数n和m(2 接下来的m行里,每行包括3个整数a,b,c.代表a和b之间有一条通路,长度为c(0 O原创 2016-03-03 10:32:42 · 2039 阅读 · 1 评论 -
hdoj 1217 Arbitrage(floyd+处理名字为字符串的情况)
Arbitrage Problem Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, supp原创 2016-02-02 02:26:28 · 325 阅读 · 0 评论 -
hdoj 2680 最短路(dijkstra)
Choose the best route Problem Description One day , Kiki wants to visit one of her friends. As she is liable to carsickness , she wants to arrive at her friend’s home as soon as possible . Now g原创 2016-02-02 01:05:56 · 365 阅读 · 0 评论 -
【hdu】2433 Travel【最短路删边】
题意: 给出一个n节点m条边的图,设这个图所有点之间最短路之和为sum,然后输出删除每一条边之后的sum值,图不联通输出inf 题解: 第一次计算所有图之间最短路之和的时候 在spfa算法里面记录used[i][j][k]代表以i节点为起点进行spfa操作的时候最短路中经过路径j,k 然后在之后进行删边操作的时候 注意重边 每次都把包含有该条边的也即used[i原创 2016-06-01 22:12:40 · 1525 阅读 · 0 评论