纠结在这句话了If it is impossible to get from some town to some other town, print "Send Kurdy" instead. Put an empty line after each test case.

题目要求是如果一旦存在一个点不能到达另一个点就输出Send Kurdy

注意处理时跳过边长超过10的再跑FLOYD。之后在所有最短路中查找最大值即可

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}
#define MAXN 105
double dp[MAXN][MAXN];
int x[MAXN],y[MAXN];
int N;
int main()
{//freopen("sample.txt","r",stdin);int T,kase = 1;scanf("%d",&T);while (T--){scanf("%d",&N);for (int i = 0; i <= N; i++)for (int j = 0; j <= N; j++)dp[i][j] = 10000000.0;for (int i = 1; i <= N; i++) scanf("%d%d",&x[i],&y[i]);for (int i = 1; i <= N; i++)for (int j = 1; j <= N; j++){double tmp = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) *(y[i] - y[j]);if (tmp > 100.0) continue;dp[i][j] = min(dp[i][j],sqrt(tmp));}for (int k = 1; k <= N; k++)for (int i = 1; i <= N; i++)for (int j = 1; j <= N; j++)dp[i][j] = min(dp[i][j],dp[i][k] + dp[k][j]);double ans = 0.0;for (int i = 1; i <= N; i++)for (int j = 1; j <= N; j++){ans = max(ans,dp[i][j]);}printf("Case #%d:\n",kase++);if (ans == 10000000.0) puts("Send Kurdy");else printf("%.4lf\n",ans);putchar('\n');}return 0;
}

转载于:https://www.cnblogs.com/Commence/p/4014081.html

UVA 10803 Thunder Mountain相关推荐

  1. UVA 10803 - Thunder Mountain

    Floyd求出任意两个城镇的距离,大于10的置为INF,使其不可达.然后求出符合条件的最大值, 输出如果都没有符合条件的就输出 Send Kurdy. #include<cstdio>#i ...

  2. UVA10803 Thunder Mountain【Floyd算法】

    "I mean, some people got guns, and some people got flashlights, and some people got batteries. ...

  3. π-Algorithmist分类题目(2)

    原题网站:Algorithmist,http://www.algorithmist.com/index.php/Main_Page π-Algorithmist分类题目(2) Set Theory U ...

  4. 提取了下刘汝佳推荐的题号...

    今天闲来没事上uva oj提取了下刘汝佳推荐的acm题号,原始数据如下: Volume 0. Getting Started    10055 - Hashmat the Brave Warrior ...

  5. 初学者acm的练习题指南

    上机练习题参考题 忘了在哪找的啦~~希望对大家有帮助呦 <!--[if !supportLists]-->1.    <!--[endif]-->Programming Bas ...

  6. uva 12222——Mountain Road

    题意:有一个狭窄的山路,两辆车不能同时相向而行,并且同向的车的间隔不能小于10秒,给定一些车的起始时间,求最后一辆车离开的最短时间. 思路:递推,dp(i,j,k)表示A端过了i辆车,B端过了j辆车, ...

  7. [搜索]UVa 129 困难的串

    题意:将一个包含两个相邻的重复子串的子串,称为"容易的串",其他为"困难的串". 输入正整数n和l,输出由前l个字符组成的,字典序第n小的困难的串. 输入样例: ...

  8. uva 401.Palindromes

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  9. Uva 3767 Dynamic len(set(a[L:R])) 树套树

    Dynamic len(set(a[L:R])) Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 https://uva.onlinejudge.org/in ...

最新文章

  1. 6台WEBLOGIC集群备份方案的讨论
  2. mysql问题举例_MySql问题总结
  3. js获取几个月前,几周前时间。
  4. 使用TFHelp解析Html
  5. 24.QTreeWidget的用法
  6. opencv-api draw
  7. MySQL中的substr()函数
  8. ServerVersion 引发了“System.InvalidOperationException”类型的异常
  9. python程序的扩展名是perl程序的扩展名是_Python 程序扩展名(py, pyc, pyw, pyo, pyd)及发布程序时的选择...
  10. Spring框架学习之SpringAOP(二)
  11. 查询一个表插入数据的时间,按BLOCK时间
  12. wps表格宏被禁用如何解禁_wps宏被禁用如何打开?
  13. VelocityTracker简单用法
  14. ArcGis利用栅格处理工具进行影像裁剪
  15. 计算机视觉的终极目标
  16. 关于ElementUI 图标字体无法正常显示异常问题处理
  17. 读研攻略(7)—从0到1,研究生第一篇SCI的诞生
  18. C语言-整数:short、int、long、long long(signed和unsigned)、原码、反码、补码
  19. WaaSMedicAgent是什么程序?又叫Windows更新医生服务
  20. 配置Linux台式机作为服务器

热门文章

  1. java属性修改前后_java 记录对象前后修改的内容(工具类)
  2. Java的表白程序_java表白程序
  3. 两个时间计算毫秒在线_蹲坑英语时间之in a jiffy
  4. 通过 IDE/Maven 部署 Serverless 应用实践
  5. 掌门教育微服务体系 Solar | 阿里巴巴 Nacos 企业级落地上篇
  6. 为什么python这么火_Python为什么这么火?你了解多少呢?
  7. html页面跳转_HTTP响应协议状态码以及跳转问题
  8. linux sort -w32,WIN32汇编: 31.列表视图控件
  9. java 矩阵求逆_java实现的顺时针/逆时针打印矩阵操作示例
  10. unity 文本输入框_unity实战项目[我是食神黑长直]1星难度.含源码