最短路
文章平均质量分 86
大白菜MC
这个作者很懒,什么都没留下…
展开
-
Heavy Transportation(最短路 Dijkstra)
Problem DescriptionBackgroundHugo 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 customer has build his giant steel crane原创 2021-01-26 19:06:24 · 581 阅读 · 0 评论 -
最短路算法Dijkstra与Floyd
Dijkstra算法Dijkstra算法采用的是一种贪心的策略,声明一个数组dis来保存源点到各个顶点的最短距离和一个保存已经找到了最短路径的顶点的数组vis,初始时,原点 s 的路径权重被赋为 0 (dis[s] = 0)。若对于顶点 s 存在能直接到达的边(s,m),则把dis[m]设为w(s, m),同时把所有其他(源点s不能直接到达的)顶点的路径长度设为无穷大。初始时,数组vis只标记顶点s。 然后,从dis数组选择最小值,则该值就是源点s到该值对应的顶点的最短路径,并且把该点加入到vis中,此时原创 2021-01-17 17:03:17 · 364 阅读 · 1 评论