题意:有两只青蛙和若干块石头,现在已知这些东西的坐标,两只青蛙A坐标和青蛙B坐标是第一个和第二个坐标,现在A青蛙想要到B青蛙那里去,并且A青蛙可以借助任意石头的跳跃,而从A到B有若干通路,问从A到B的所有通路上的最大边

链接:点我

floyd变形即可

 #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
#define MOD 1000000007
#define pb(a) push_back(a)
const int INF=0x3f3f3f3f;
const double eps=1e-;
typedef long long ll;
#define cl(a) memset(a,0,sizeof(a))
#define ts printf("*****\n");
const int MAXN=;
int n,m,tt,cnt;
struct Node
{
int x,y;
void in()
{
scanf("%d%d",&x,&y);
}
}node[MAXN];
double dis(Node a,Node b)
{
return sqrt((double)(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double dist[MAXN][MAXN]; int main()
{
int i,j,k;
#ifndef ONLINE_JUDGE
freopen("1.in","r",stdin);
#endif
int ca=;
while(scanf("%d",&n)!=EOF)
{
if(n==) break;
for(i=;i<n;i++)
{
node[i].in();
}
cl(dist);
for(i=;i<n;i++)
{
for(j=;j<n;j++)
{
if(i==j) continue;
else dist[i][j]=dist[j][i]=dis(node[i],node[j]);
}
}
for(k=;k<n;k++)
{
for(i=;i<n;i++)
{
for(j=;j<n;j++)
{
if(dist[i][j]>max(dist[i][k],dist[k][j])) dist[i][j]=max(dist[i][k],dist[k][j]);
}
}
}
printf("Scenario #%d\nFrog Distance = %.3lf\n\n",ca++,dist[][]);
}
return ;
}

poj 2253 最短路floyd **的更多相关文章

  1. POJ 2253 Frogger(floyd)

    http://poj.org/problem?id=2253 题意 : 题目是说,有这样一只青蛙Freddy,他在一块石头上,他呢注意到青蛙Fiona在另一块石头上,想去拜访,但是两块石头太远了,所以 ...

  2. poj 2253 Frogger(floyd变形)

    题目链接:http://poj.org/problem?id=1797 题意:给出两只青蛙的坐标A.B,和其他的n-2个坐标,任一两个坐标点间都是双向连通的.显然从A到B存在至少一条的通路,每一条通路 ...

  3. POJ 2253 Frogger (Floyd)

    Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions:57696   Accepted: 18104 Descript ...

  4. poj 2253 最短路 or 最小生成树

    Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sit ...

  5. 最短路(Floyd_Warshall) POJ 2253 Frogger

    题目传送门 /* 最短路:Floyd算法模板题 */ #include <cstdio> #include <iostream> #include <algorithm& ...

  6. poj 2253 Frogger (最长路中的最短路)

    链接:poj 2253 题意:给出青蛙A,B和若干石头的坐标,现青蛙A想到青蛙B那,A可通过随意石头到达B, 问从A到B多条路径中的最长边中的最短距离 分析:这题是最短路的变形,曾经求的是路径总长的最 ...

  7. POJ 2253 Frogger ,poj3660Cow Contest(判断绝对顺序)(最短路,floyed)

    POJ 2253 Frogger题目意思就是求所有路径中最大路径中的最小值. #include<iostream> #include<cstdio> #include<s ...

  8. POJ 2253 ——Frogger——————【最短路、Dijkstra、最长边最小化】

    Frogger Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Stat ...

  9. POJ 2253 Frogger(dijkstra 最短路

    POJ 2253 Frogger Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fion ...

随机推荐

  1. angularJs实现动态增加输入框

    摘要:首先,有一个这样的需求,就是说,我点击添加,会动态出现需要输入的输入框.我们需要定义一个对象,类似这种, {spc:{},spctions:[]} 意思是spc对应的是一个对象,spctions ...

  2. 什么是HTTP协议

    什么是Http协议Http协议即超文本传送协议 (HTTP-Hypertext transfer protocol) .它定义了浏览器(即万维网客户进程)怎样向万维网服务器请求万维网文档,以及服务器怎 ...

  3. bzoj千题计划269:bzoj2655: calc (拉格朗日插值)

    http://www.lydsy.com/JudgeOnline/problem.php?id=2655 f[i][j] 表示[1,i]里选严格递增的j个数,序列值之和 那么ans=f[A][n] * ...

  4. 比马卡龙好看N倍的中式甜点

  5. 消息队列之RabbitMQ的.Net客户端EasyNetQ

    https://www.cnblogs.com/CoderAyu/p/9072408.html http://www.cnblogs.com/panzi/p/6337568.html http://w ...

  6. js数组方法forEach,map,filter,every,some实现

    Array.prototype.map = function(fun /*, thisp*/) { var len = this.length; if (typeof fun != "fun ...

  7. usb device address error 110

    ubuntu失灵了,怎么都起不来,报一堆错误usb device descriptor read/64, error 110......重启,换kvm的接口,usb键盘鼠标...终于在试了下面这个方法 ...

  8. click模块使用

    # coding:utf8 import time import click @click.command() @click.option('--id', default='123', help='a ...

  9. 百度编辑器ueditor 字符限制

    百度编辑器ueditor 字符限制 默认只能输入10000个字符 修改 ueditor.config.js // ,wordCount:true //是否开启字数统计 // ,maximumWords ...

  10. 过滤掉文本中的javascript标签代码

    2014年1月21日 11:51:19 php代码: $content = preg_replace('#<\s*[script].*>#', '', $a);//有些攻击可以在scrip ...