1. 

package problemSetVolumes.volume005;

import java.util.*;

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 534 - Frogger
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=7&page=show_problem&problem=475
*
* @author Siegfried Ippisch
* @author Michael Haus
* @author Martin Lambeck
* @version 1.0
*
* Method : Floyd–Warshall algorithm
* Status : Accepted
* Runtime: 0.424
*/
public class Frogger {

static Scanner in = new Scanner(System.in);
static List<Point> points = new ArrayList<Point>(200);
static int tcase = 1;

public static void main(String[] args){

while(testcase());
in.close();
}

public static boolean testcase()
{
int nodes = in.nextInt();
double[][] adja = new double[nodes][nodes];

if (nodes == 0)
return false;

points.clear();

for (int i = 0; i < nodes; i++)
{
points.add(new Point(in.nextInt(), in.nextInt()));
}

for (int i = 0; i < nodes; i++)
{
for (int h = 0; h < nodes; h++)
{
adja[i][h] = points.get(i).distance(points.get(h));
}
}

for (int k = 0; k < nodes; k++)
for (int i = 0; i < nodes; i++)
for (int j = 0; j < nodes; j++)
adja[i][j] = Math.min(adja[i][j], Math.max(adja[i][k], adja[k][j]));

System.out.printf("Scenario #%d\nFrog Distance = %.3f\n\n", tcase, adja[0][1]);

//in.nextLine();

tcase++;
return true;
}

}

class Point
{
int x;
int y;

public Point (int xx, int yy)
{
x = xx;
y = yy;
}

public double distance (Point other)
{
int dx = x - other.x;
int dy = y - other.y;

return Math.sqrt(dx * dx + dy * dy);
}
}