
最短路(Bellman-Ford)
文章平均质量分 70
林伏案
妖蛾子良多的范老爷
展开
-
Bellman-Ford算法
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <vector>using namespace std; const int maxn = 100000 + 5; const int INF = 99999999;int d[maxn], cnt[maxn], n, m; //原创 2016-04-25 23:23:48 · 267 阅读 · 0 评论 -
poj1860(最短路,负环)
/* translation: 给出若干货币,以及货币之间的转换方法。假设知道A->B:r=29.75,c=0.39。则由100货币A转换为B为 B=(100 - 0.39) * 29.75 。现在给你一种特定的货币以及每种货币间的r和c,求其能否通过某种转换方式 使得最终转换为本来货币时,资产增加? solution: 最短路径的bellmanFord算法,判断负环。 可以设dis原创 2016-08-21 15:07:26 · 489 阅读 · 1 评论