floyd的应用求每条路径两点之间最大距离的最小值

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int a[205],b[205],d[205][205];
int main(int argc, char *argv[])
{
int n,i,j,k,m=0;
while(cin>>n&&n)
{
for(i=0;i<n;i++)
cin>>a[i]>>b[i];
for(i=0;i<n;i++)
for(j=0;j<n;j++)
d[i][j]=(a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]);
for(k=0;k<n;k++)
for(i=0;i<n;i++)
for(j=0;j<n;j++)
d[i][j]=min(d[i][j],max(d[i][k],d[k][j]));
printf("Scenario #%d\nFrog Distance = %.3lf\n\n",++m,sqrt((double)d[0][1]));
}
return 0;
}

http://poj.org/problem?id=2253的更多相关文章

  1. poj 1651 http://poj.org/problem?id=1651

      http://poj.org/problem?id=1651Multiplication Puzzle   Time Limit: 1000MS   Memory Limit: 65536K To ...

  2. poj-3056 http://poj.org/problem?id=3056

    http://poj.org/problem?id=3056 The Bavarian Beer Party Time Limit: 6000MS   Memory Limit: 65536K Tot ...

  3. poj 1679 http://poj.org/problem?id=1679

    http://poj.org/problem?id=1679 The Unique MST Time Limit: 1000MS   Memory Limit: 10000K Total Submis ...

  4. POJ3278http://poj.org/problem?id=3278

    http://poj.org/problem?id=3278 题目大意: m,n两个数m可+1, -1, *2变成n,需要经过几步 #include<stdio.h> #include&l ...

  5. 最小生成树 10.1.5.253 1505 poj 1258 http://poj.org/problem?id=1258

    #include <iostream>// poj 1258 10.1.5.253 1505 using namespace std; #define N 105 // 顶点的最大个数 ( ...

  6. http://poj.org/problem?id=3278(bfs)

    Catch That Cow Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 76935   Accepted: 24323 ...

  7. poj 1915 http://poj.org/problem?id=1915

    /**< */#include <stdio.h> #include <string.h> #include <stdlib.h> #include < ...

  8. Roadblocks http://poj.org/problem?id=3255

    Description Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best ...

  9. 线段树 (区间更新,区间查询) poj http://poj.org/problem?id=3468

    题目链接 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

随机推荐

  1. ios 网络字节顺序的转换HTOS

    最近用socket发送data遇到个问题,字节高地位和服务器不匹配,搞了好久才找到解决的方案,主要用到两个函数HTOL HTOS STOH LTOL 故写此博文 什么是字节序 采用维基百科的解释如下: ...

  2. 排名第一、第二的OCR软件

    排名第一.第二的OCR软件 第一:ABBYY FineReader      OCR世界排名第一,在俄罗斯获国际科技大奖奖超过卡巴斯基! 不仅仅只是文字识别,还能表格识别,版面还原,字体识别,文档结构 ...

  3. ECMall注册机制简要分析

    ecmall的注册流程index.php?app=member&act=register. 首先app是member,act是register方法. index.php中.通过ecmall的s ...

  4. Eclipse下设置github开发环境

    1.按照github上的指南配置(http://help.github.com/win-set-up-git/)基础的git环境. 2.在github上创建一个Repository. 3.在Eclip ...

  5. Android应用架构

    Android开发生态圈的节奏非常之快.每周都会有新的工具诞生,类库的更新,博客的发表以及技术探讨.如果你外出度假一个月,当你回来的时候可能已经发布了新版本的Support Library或者Play ...

  6. Android用户界面UI组件--AdapterView及其子类(三) ExpandableListView

    ExpandableListView: List中的每一项可以展开收缩. 一种伸缩式的ListView. android:cacheColorHint="#00000000" 这个 ...

  7. Lua table pair和ipair区别

    官方描述: ipairs (t) Returns three values: an iterator function, the table t, and 0, so that the constru ...

  8. 【CF】310 Div.1 C. Case of Chocolate

    线段树的简单题目,做一个离散化,O(lgn)可以找到id.RE了一晚上,额,后来找到了原因. /* 555C */ #include <iostream> #include <str ...

  9. 【HDOJ】2157 How many ways??

    矩阵乘法,用DP做各种wa,后来发现原因了. #include <stdio.h> #include <string.h> typedef struct { ][]; } ma ...

  10. cssViewer牛逼的chrome插件

    很牛逼,功能很强大.