Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
Max distance
Shqip
Traveling salesman problem is a famous problem. According
to the question, the salesman has to travel throgh n islands.
And then in the end, he has to return back to his starting island.
Question: Write a program that
gets the x and y coordinates of n islands. Then, the program
calculates the max Euclidean distance to travel between
two cities according to the given order. The distances
between the two consecutive islands are calculated.
The last island is connected to the first island.
Input specification
You will be given an integer number (n). Then, in the following n
lines, you will be given x and y coordinates of n islands
where 1 ≤ n ≤ 40000 and coordinates -5000 ≤
(x and y) ≤ 5000.
Output specification
Show one number with 2 digits double precision,
which is the max distance.
Sample Input
4
1 1
2 2
2 4
1 4
|
Sample Output
3
|
Explanation:
According to the given order, the distances are:
- between 1st and 2nd islands is 1.414
- between 2nd and 3rd islands is 2.0
- between 3rd and 4th islands is 1.0
- between 4th and 1st islands is 3.0
And the distance between the 4th and 1st islands is
the max distance.
Для отправки решений необходимо выполнить вход.
|