码迷,mamicode.com
首页 >  
搜索关键字:最短路变形    ( 68个结果
UVA - 10537 The Toll! Revisited (最短路变形逆推)
Description Problem G Toll! Revisited Input: Standard Input Output: Standard Output Time Limit: 1 Second   Sindbad the Sailor sold 66 silver spoons to the Sultan of Samarkand. The selling...
分类:其他好文   时间:2014-07-21 13:35:07    阅读次数:263
Zoj 2027 Travelling Fee 最短路变形
给你一个图和AB,问你从A到B的路径中,当每条路径的最长的边长度忽略的情况下,A到B的最短路.建立两个矩阵,一个记录最大长度,一个是最短路,同步更新即可.#include #include #include #include #include #include #include #include #...
分类:其他好文   时间:2014-07-21 00:02:02    阅读次数:196
POJ 2472 106 miles to Chicago
最短路问题变形。 题意是给你一些道路,和路过时不被抓的概率。要求找一条到达目的地时不被抓的最大概率概率。 初始 dis[]设为 1 。其余为 0 。找最大即可。 #include #include #include #include #include #include #include #include #include #include #include #define I...
分类:其他好文   时间:2014-07-20 22:27:03    阅读次数:182
POJ 2570 Fiber Network
最短路变形。 题意是说不同的点之间有不同的公司建立了不同连接。 询问 A,B之间如果存在通路,有那些公司。 我用bool  g[][][26] 来表示26个字母。然后Floyd, G++就超时。C++ 就AC了。 然后看别人代码才知道还有位运算……ORZ。。。 自己的代码:C++ AC。813ms #include #include #inclu...
分类:Web程序   时间:2014-07-19 23:47:19    阅读次数:353
POJ 2263 Heavy Cargo(ZOJ 1952)
最短路变形或最大生成树变形。 问 目标两地之间能通过的小重量。 用最短路把初始赋为INF,其他为0.然后找 dis[v]=min(dis[u], d); 生成树就是把最大生成树找出来,直到出发和终点能沟通的时候,最小的边就是。 Kruskal: #include #include #include #include #include #include #include...
分类:其他好文   时间:2014-07-19 23:22:59    阅读次数:236
ZOJ 1655 Transport Goods
最短路问题变形。 题意是说从各个点运送东西到 n;能剩下来最多的。(无向图) 整体变成了求到各点时 最大的 剩余率。 边权变成了过路费率p,0 存储的时候用 1-p 存 剩余率。实际剩下的货物是 goods *(1-p) #include #include #include #include #include #include #include #include #inclu...
分类:其他好文   时间:2014-07-03 17:39:24    阅读次数:190
POJ 2253 Frogger
多种方法,可以理解为最短路变形。 也可以当作最小生成树。 题意理解就很简单。 青蛙A到青蛙B之间距离中某一次跳的距离,选出最大的。 写了2个最短路的。SPFA 和 Dijkstra。 顺便熟悉一下最小生成树,也写个Kruskal 的。 SPFA: #include #include #include #include #include #include #...
分类:其他好文   时间:2014-07-03 13:52:06    阅读次数:146
UESTC 915 方老师的分身II --最短路变形
即求从起点到终点至少走K条路的最短路径。用两个变量来维护一个点的dis,u和e,u为当前点的编号,e为已经走过多少条边,w[u][e]表示到当前点,走过e条边的最短路径长度,因为是至少K条边,所以大于K条边的当做K条边来处理就好了。求最短路的三个算法都可以做,我这里用的是SPFA,比较简洁。代码:#...
分类:其他好文   时间:2014-06-15 12:09:25    阅读次数:248
68条   上一页 1 ... 5 6 7
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!