#C7235. Traveling Salesman Problem: Minimal Circular Route
Traveling Salesman Problem: Minimal Circular Route
Traveling Salesman Problem: Minimal Circular Route
You are given a set of stops on a 2D plane, each described by its coordinates. Your task is to compute the minimum total distance required to visit all stops exactly once and return to the starting point. The distance between two points ( (x_1, y_1) ) and ( (x_2, y_2) ) is given by the Euclidean distance formula: ( \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2} ).
Note that if there is only one stop, the result is ( 0.0000 ). The answer must be displayed with exactly four decimal places.
inputFormat
The input begins with an integer ( n ) (( 1 \leq n \leq 10 )) representing the number of stops. This is followed by ( n ) lines, each containing two space-separated integers that represent the coordinates ( x ) and ( y ) of a stop.
outputFormat
Output the minimum route distance that visits every stop exactly once and returns to the starting point. The answer should be printed as a floating point number rounded to 4 decimal places.## sample
4
0 0
1 0
1 1
0 1
4.0000