纠结在这句话了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 == ? 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 = ;
scanf("%d",&T);
while (T--)
{
scanf("%d",&N);
for (int i = ; i <= N; i++)
for (int j = ; j <= N; j++)
dp[i][j] = 10000000.0;
for (int i = ; i <= N; i++) scanf("%d%d",&x[i],&y[i]);
for (int i = ; i <= N; i++)
for (int j = ; 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 = ; k <= N; k++)
for (int i = ; i <= N; i++)
for (int j = ; j <= N; j++)
dp[i][j] = min(dp[i][j],dp[i][k] + dp[k][j]);
double ans = 0.0;
for (int i = ; i <= N; i++)
for (int j = ; 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 ;
}

UVA 10803 Thunder Mountain的更多相关文章

  1. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  2. Root :: AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 7. Graph Algorithms and Implementation Techniques

    uva 10803 计算从任何一个点到图中的另一个点经历的途中必须每隔10千米 都必须有一个点然后就这样 floy 及解决了 ************************************* ...

  3. uva 12222 Mountain Road

    题意: 有一个单行道,两个方向都有车在等待.给出每个车的方向以及到达的时间以及走完这段路所需要的时间. 为了防止车祸,同向两车通过任一点的时间间隔不得小于10s. 求最后一辆车离开时刻的最小值. 思路 ...

  4. UVa 11167 Monkeys in the Emei Mountain (最大流)

    题意:雪雪是一只猴子.它在每天的 2:00 —— 9:00之间非常渴,所以在这个期间它必须喝掉2个单位的水.它可以多次喝水,只要它喝水的总量是2.它从不多喝,在一小时内他只能喝一个单位的水.所以它喝水 ...

  5. HDU5838 Mountain(状压DP + 容斥原理)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5838 Description Zhu found a map which is a N∗M ...

  6. uva 1354 Mobile Computing ——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGcAAANuCAYAAAC7f2QuAAAgAElEQVR4nOy9XUhjWbo3vu72RRgkF5

  7. UVA 10564 Paths through the Hourglass[DP 打印]

    UVA - 10564 Paths through the Hourglass 题意: 要求从第一层走到最下面一层,只能往左下或右下走 问有多少条路径之和刚好等于S? 如果有的话,输出字典序最小的路径 ...

  8. UVA 11404 Palindromic Subsequence[DP LCS 打印]

    UVA - 11404 Palindromic Subsequence 题意:一个字符串,删去0个或多个字符,输出字典序最小且最长的回文字符串 不要求路径区间DP都可以做 然而要字典序最小 倒过来求L ...

  9. UVA&&POJ离散概率与数学期望入门练习[4]

    POJ3869 Headshot 题意:给出左轮手枪的子弹序列,打了一枪没子弹,要使下一枪也没子弹概率最大应该rotate还是shoot 条件概率,|00|/(|00|+|01|)和|0|/n谁大的问 ...

随机推荐

  1. [Codeforces958E2]Guard Duty (medium)(区间DP)

    Description 题目链接 Solution 可以把题目转化一下模型,将间隔取出来,转化为N-1个数,限制不能取相邻两个数,求取K个数的最小价值 设DP[i][j]表示前i个数取j个最大价值(第 ...

  2. python Beautiful Soup库入门

    bs4库的HTML内容遍历方法 基于bs4库的HTML格式输出 显示:友好的显示 <tag>.prettify() 编码:bs4库将任何HTML输入都变成utf-8编码(python 3. ...

  3. Android 文件管理器通用类 FileUtil

    1.整体分析 1.1.源代码如下,可以直接Copy. public class FileUtil { private FileUtil() { } //****系统文件目录************** ...

  4. MySQL之查询性能优化(三)

    MySQL查询优化器的局限性 MySQL的万能“嵌套循环”并不是对每种查询都是最优的.不过还好,MySQL查询优化只对少部分查询不适用,而且我们往往可以通过改写查询让MySQL高效地完成工作. 关联子 ...

  5. lintcode

    public class Solution { /** * @param s: The first string * @param b: The second string * @return tru ...

  6. DOS程序员手册(六)

    217页 程序的主要部分后面是主程序所使用的许多小的扩充内存功能.将这些功能组合起 来这些功能便覆盖了扩充内存的操作,尽管还可能想向它们添加错误检查. 程序所包含的函数有: emmtest   检验内 ...

  7. sources-x.list

    deb http://debian.ustc.edu.cn/ubuntu/ xenial main multiverse restricted universe deb http://debian.u ...

  8. 【2017】KK English

    2017/11/24 Regardless of the enormous amount of photos shared on Wechat or Face book, modern city dw ...

  9. HDU 4027 Can you answer these queries(线段树 + 观察 )

    这题主要考察观察能力. 2^63最多只需要开7次根号就会变成1,当数字变成1之后就不需要再对其进行操作. 对于含有大于1数字的区间,向下更新. 对于数字全为1的区间,直接返回. #include &l ...

  10. KMP与循环节相关题目

    HDU 3746 Cyclic Nacklace ( KMP求最小循环节 ) len - nextval[len]即为最小循环节长度. #include <cstdio> #include ...