HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


151. 50560 - Max Distance

Guest
• Review clarifications (1)

Volume problems

• 135. 50392 - How much space
• 136. 50443 - Dajte Express
• 140. 50655 - Divisibility by 9
• 145. 50656 - Divisibility by 11
• 147. 50553 - Divisible by m
• 148. 50596 - Your Ride Is Here (US...
• 148. 50596 - Your Ride Is Here (US...
• 150. 50763 - Valid Password
• 151. 50560 - Max Distance
• 153. 50368 - Right-most non zero d...
• 155. 50379 - a^b modulus k
• 158. 50404 - Sum of Self Powers
• 160. 50546 - Average Fuel Price
• 180. 50343 - The number of Ending...
• 30. 50764 - Fast Typing Competition

Feedback

If you notice incorrect translations in Contester, please let author know.

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.

Для отправки решений необходимо выполнить вход.

www.contester.ru