1405 奶牛的旅行

题目描述 Description

农民John的农场里有很多牧区。有的路径连接一些特定的牧区。一片所有连通的牧区称为一个牧场。但是就目前而言,你能看到至少有两个牧区通过任何路径都不连通。这样,农民John就有多个牧场了。  John想在农场里添加一条路径(注意,恰好一条)。对这条路径有以下限制:  一个牧场的直径就是牧场中最远的两个牧区的距离(本题中所提到的所有距离指的都是最短的距离)。考虑如下的有5个牧区的牧场,牧区用“*”表示,路径用直线表示。每一个牧区都有自己的坐标:         15,15 20,15          D   E          *-------*          |   _/|          | _/ |          | _/  |          |/   |     *--------*-------*     A    B   C     10,10 15,10 20,10 这个牧场的直径大约是12.07106, 最远的两个牧区是A和E,它们之间的最短路径是A-B-E。  这里是另一个牧场:               *F 30,15             /             _/            _/            /             *------*           G   H          25,10 30,10 这两个牧场都在John的农场上。John将会在两个牧场中各选一个牧区,然后用一条路径连起来,使得连通后这个新的更大的牧场有最小的直径。  注意,如果两条路径中途相交,我们不认为它们是连通的。只有两条路径在同一个牧区相交,我们才认为它们是连通的。  输入文件包括牧区、它们各自的坐标,还有一个如下的对称邻接矩阵:    A B C D E F G H  A 0 1 0 0 0 0 0 0 B 1 0 1 1 1 0 0 0 C 0 1 0 0 1 0 0 0 D 0 1 0 0 1 0 0 0 E 0 1 1 1 0 0 0 0 F 0 0 0 0 0 0 1 0 G 0 0 0 0 0 1 0 1 H 0 0 0 0 0 0 1 0 输入文件至少包括两个不连通的牧区。  请编程找出一条连接两个不同牧场的路径,使得连上这条路径后,这个更大的新牧场有最小的直径。

输入描述 Input Description

第1行: 一个整数N (1 <= N <= 150), 表示牧区数  第2到N+1行: 每行两个整数X,Y (0 <= X ,Y<= 100000), 表示N个牧区的坐标。注意每个 牧区的坐标都是不一样的。  第N+2行到第2*N+1行: 每行包括N个数字(0或1) 表示如上文描述的对称邻接矩阵。

输出描述 Output Description

只有一行,包括一个实数,表示所求直径。数字保留六位小数。

样例输入 Sample Input

8 10 10 15 10 20 10 15 15 20 15 30 15 25 10 30 10 01000000 10111000 01001000 01001000 01110000 00000010 00000101 00000010

样例输出 Sample Output

22.071068

数据范围及提示 Data Size & Hint

1s

分类标签 Tags 点此展开 

 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 sscanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格canf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格 scanf会读空格

  1 #include<iostream>
  2 #include<cstdio>
  3 #include<cstring>
  4 #include<queue>
  5 #include<cmath>
  6 using namespace std;
  7 double maxn=1e12;
  8 double x[1001];
  9 double y[1001];
 10 double cd(int i,int j)
 11 {
 12     return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
 13 }
 14 double map[1001][1001];
 15 double m[10001];//点i可以到达的最大距离 
 16 int main()
 17 {
 18     int n;
 19     scanf("%d",&n);
 20     for(int i=1;i<=n;i++)
 21     {
 22         scanf("%lf%lf",&x[i],&y[i]);
 23     }
 24     for(int i=1;i<=n;i++)
 25     {
 26         for(int j=1;j<=n;j++)
 27         {
 28             char kk;
 29             //scanf("%c",&kk);
 30             cin>>kk;
 31             if(kk=='1')
 32             {
 33                 double tmp=cd(i,j);
 34                 map[i][j]=tmp;
 35             }
 36             else
 37             {
 38                 map[i][j]=maxn;
 39             }
 40         }
 41     }
 42     for(int k=1;k<=n;k++)
 43     {
 44         for(int i=1;i<=n;i++)
 45         {
 46             for(int j=1;j<=n;j++)
 47             {
 48                 if(i!=j&&i!=k&&j!=k)
 49                 {
 50                     if(map[i][k]<maxn-1&&map[k][j]<maxn-1)
 51                     {
 52                         if(map[i][j]>map[i][k]+map[k][j])
 53                         {
 54                             map[i][j]=map[i][k]+map[k][j];
 55                         }
 56                     }
 57                     
 58                 }
 59                 
 60             }
 61         }
 62     }
 63     memset(m,0,sizeof(m));
 64     for(int i=1;i<=n;i++)
 65     {
 66         for(int j=1;j<=n;j++)
 67         {
 68             if(map[i][j]<maxn-1)
 69             {
 70                 if(m[i]<map[i][j])
 71                 {
 72                     m[i]=map[i][j];
 73                 }
 74             }
 75             
 76         }
 77     } 
 78     double r2=maxn;
 79     for(int i=1;i<=n;i++)
 80     {
 81         for(int j=1;j<=n;j++)
 82         {
 83             if(map[i][j]>maxn-1&&i!=j)
 84             {
 85                 double tmp=cd(i,j);
 86                 double nn=m[i]+m[j]+tmp;
 87                 if(r2>nn)
 88                 r2=nn;
 89             }
 90         }
 91     }
 92     double r1=-1;
 93     for(int i=1;i<=n;i++)
 94     {
 95         
 96         if(m[i]>r1)
 97         r1=m[i];
 98     }
 99     printf("%.6lf",max(r1,r2));
100     return 0;
101 }

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏蜉蝣禅修之道

Max-Min Fairness带宽分配算法

2266
来自专栏何俊林

如何学习OpenGL Shader开发?

shader也称着色器,着色器是运行在GPU上的小程序,着色器是一种C风格语言——GLSL。

2812
来自专栏walterlv - 吕毅的博客

出让执行权:Task.Yield, Dispatcher.Yield

发布于 2017-10-14 09:18 更新于 2018-02...

1231
来自专栏数据结构与算法

HDU4352 XHXJ's LIS(LIS 状压)

刚开始的思路是$f[i][j]$表示到第$i$位,LIS长度为$j$的方案。 然而发现根本不能转移,除非知道了之前的状态然后重新dp一遍。。

973
来自专栏从流域到海域

迪杰斯特拉(Dijkstra)算法求图中最短路径

迪杰斯特拉(Dijkstra )算法: 对于图G=(V,E),将图的顶点分为两组: 顶点集S:已求出的最短路径的顶点集合(初始为{v0}); 顶...

2277
来自专栏聊聊技术

原 "二分查找(Binary Search

43311
来自专栏Code_iOS

OpenGL ES 2.0 (iOS)[03]:熟练图元绘制,玩转二维图形

文章的大前提是,你得有《OpenGL ES 2.0 (iOS): 一步从一个小三角开始》的基础知识。

2131
来自专栏深度学习之tensorflow实战篇

igraph软件包创建图和网络(创建邻接矩阵)

一、igraph软件包创建图和网络 igraph 是一个独立的库,底层是 C,上层有 Python 和 R 接口,主要做图和网络方面的计算,附带绘图功能。 ...

6374
来自专栏落影的专栏

iOS开发-OpenGL ES入门教程1

前言 这里是一篇新手教程,环境是Xcode7+OpenGL ES 2.0,目标写一个OpenGL ES的hello world。 OpenGL ES系列教程在...

3369
来自专栏潇涧技术专栏

Python Algorithms - C2 The basics

本节主要介绍了三个内容:算法渐近运行时间的表示方法、六条算法性能评估的经验以及Python中树和图的实现方式。

1112

扫码关注云+社区

领取腾讯云代金券