最短路
阳光吹雪
What doesn't kill you makes you stronger!
展开
-
最短路变形 :Heavy Transportation
Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his cust...原创 2019-01-22 10:53:46 · 168 阅读 · 0 评论 -
Bellman-Ford判断是否有负权回路!!!
存在负权回路为1,不存在为0。 下面标记星号的意思是如果所有的路径已经是最优的,就不用更新了直接break。如果不加带星号的这两行的话的话,数据一多就可能超时。 Bellman-Ford spfa(int t) //从t点开始遍历 { dis[t] = 0; for(int i = 1; i <= n - 1; i++) { int flag ...原创 2019-01-22 20:53:43 · 292 阅读 · 0 评论