#K73322. Traveling Salesman Problem: Minimum Travel Distance
Traveling Salesman Problem: Minimum Travel Distance
Traveling Salesman Problem: Minimum Travel Distance
You are given a set of delivery locations represented by their coordinates in the plane. Your task is to determine the minimum total distance required for a truck to visit each delivery location exactly once and then return to the starting point. The distance between two points \((x_1,y_1)\) and \((x_2,y_2)\) is computed using the Euclidean distance formula:
[ \sqrt{(x_1-x_2)^2+(y_1-y_2)^2} ]
You must consider all possible orders of visiting the locations (i.e. solve the TSP by brute force) and find the minimum possible route distance. The answer should be rounded to exactly two decimal places.
inputFormat
The input is given via standard input and is structured as follows:
- The first line contains an integer \(n\) (where \(2 \leq n \leq 10\)), the number of delivery locations.
- The following \(n\) lines each contain two integers representing the \(x\) and \(y\) coordinates of a delivery location.
Note: It is guaranteed that \(n\) will be small enough to allow a brute force solution.
outputFormat
Output to standard output a single line containing the minimum total travel distance, rounded to two decimal places.
## sample4
0 0
2 0
2 2
0 2
8.00