最短路
jia_zheng
这个作者很懒,什么都没留下…
展开
-
POJ 2387 Til the Cows Come Home (dijikstra)
DescriptionBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she want原创 2017-02-28 19:57:06 · 558 阅读 · 0 评论 -
迪杰斯特拉算法
首先设置顶点集合S, 将起始点加入该集合,根据起始点到其他顶点的路径长度,选择路径长度最小的顶点加入集合,根据所加入顶点更新源点到其他顶点的路径长度,然后在寻找最小边的顶点,重复上述操作直到求出所有顶点的长度。下面是代码:void dijkstra (int n) { for (int i=1; i<=n; ++i) { vis[i] = 0; dis原创 2017-01-20 20:21:12 · 291 阅读 · 0 评论 -
POJ 1125 Stockbroker Grapevine(Floyd算法)
DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in t原创 2017-03-03 20:23:00 · 199 阅读 · 0 评论