UVA - 10099 The Tourist Guide
来源:互联网 发布:机房 蓝屏 网络攻击 编辑:程序博客网 时间:2024/05/20 09:22
题意:跟之前的一题Floyd是一样的,就是求路径中的最小值最大,然后求来回的次数,记住导游也要考虑进去
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 110;int dp[MAXN][MAXN];int n,r,a,b,t;int main(){ int cas = 1; while (scanf("%d%d",&n,&r) != EOF && n+r){ memset(dp,-1,sizeof(dp)); for (int i = 1; i <= n; i++) dp[i][i] = 0; while (r--){ scanf("%d%d%d",&a,&b,&t); dp[a][b] = dp[b][a] = t; } for (int k = 1; k <= n; k++) for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) dp[i][j] = max(dp[i][j],min(dp[i][k],dp[k][j])); scanf("%d%d%d",&a,&b,&t); int ans = dp[a][b] -1; printf("Scenario #%d\n",cas++); printf("Minimum Number of Trips = %d\n\n",t/ans+(t%ans?1:0)); } return 0;}
- uva 10099 The Tourist Guide
- UVa 10099 The Tourist Guide
- Uva 10099 - The Tourist Guide
- UVA 10099 - The Tourist Guide
- UVa:10099 The Tourist Guide
- UVA - 10099 The Tourist Guide
- UVa 10099 - The Tourist Guide
- UVA 10099 The Tourist Guide
- uva 10099 The Tourist Guide
- UVA 10099 - The Tourist Guide
- The Tourist Guide(uva)
- UVA 10099 - The Tourist Guide(floyd)
- UVA - 10099 The Tourist Guide kruskal算法
- The Tourist Guide - UVa 10099 Floyd
- uva 10099 - The Tourist Guide翻译
- UVA 10099The Tourist Guide【floyd】
- 10099 The Tourist Guide
- 10099 - The Tourist Guide
- Android组件间的交互和进程间IPC通信
- js判断手机访问网站自动跳转到手机版
- ffmpeg 多线程初始化,需要做的事
- Linux远程连接Windows:rdesktop
- 关于 AemulaOldies 的备忘录
- UVA - 10099 The Tourist Guide
- (Warshall13.1.1)POJ 2253(计算任意一对顶点之间的连通性||求最大路的最小值——图的传递闭包)
- hdu 4426 Palindromic Substring 字符串hash
- 从今天开始我将和大家分享下(仿微信飞机) cocos2d-x 2.2版的实现过程 (一)
- Core Data的使用
- Cluster中3个Nodes挂掉2个,恢复Recovery Pending的DB的方案探索
- 入门视频采集与处理(学会分析YUV数据)
- JAVA系列-设计模式-命令模式
- Android应用检测更新