ACM: 图论题 poj 2253 (poj上的dou…
来源:互联网 发布:淘宝网店加盟哪家好 编辑:程序博客网 时间:2024/05/19 00:35
Description
Freddy Frog is sitting on a stone in the middle of a lake.Suddenly he notices Fiona Frog who is sitting on another stone. Heplans to visit her, but since the water is dirty and full oftourists' sunscreen, he wants to avoid swimming and instead reachher by jumping.
Unfortunately Fiona's stone is out of his jump range. ThereforeFreddy considers to use other stones as intermediate stops andreach her by a sequence of several small jumps.
To execute a given sequence of jumps, a frog's jump range obviouslymust be at least as long as the longest jump occuring in thesequence.
The frog distance (humans also call it minimax distance) betweentwo stones therefore is defined as the minimum necessary jump rangeover all possible paths between the two stones.
You are given the coordinates of Freddy's stone, Fiona's stone andall other stones in the lake. Your job is to compute the frogdistance between Freddy's and Fiona's stone.
Input
The input will contain one or more test cases. The first line ofeach test case will contain the number of stones n(2<=n<=200). The next n lines eachcontain two integers xi,yi (0 <= xi,yi<= 1000) representing the coordinates of stone #i.Stone #1 is Freddy's stone, stone #2 is Fiona's stone, the othern-2 stones are unoccupied. There's a blank line following each testcase. Input is terminated by a value of zero (0) for n.
Output
For each test case, print a line saying "Scenario #x" and a linesaying "Frog Distance = y" where x is replaced by the test casenumber (they are numbered from 1) and y is replaced by theappropriate real number, printed to three decimals. Put a blankline after each test case, even after the last one.
Sample Input
2
0 0
3 4
3
17 4
19 4
18 5
0
Sample Output
Scenario #1
Frog Distance = 5.000
Scenario #2
Frog Distance = 1.414
题意:
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
#define MAX 350
int info[MAX][2];
int edges[MAX][MAX];
int n;
int dist(int a1,int b1,int a2,int b2)
{
}
int max(int a,int b)
{
}
void read_graph()
{
}
void floyd()
{
}
int main()
{
//