#P1171. 售货员的难题
售货员的难题
Description
In a certain township, there are villages. A salesman needs to visit each village to sell goods. The distances between villages are known, and, in general, the road from village A to village B may be different from the road from village B to village A. To improve efficiency, he starts from the store, visits each village exactly once, and then returns to the village where the store is located. Assume the store is in village . He does not know which route will minimize the total distance traveled. Please help him choose a route with the shortest total length.
Input Format
The first line contains an integer , the number of villages.
The next lines each contain integers. In the -th line, the -th integer represents the distance of the one-way path from to .
Output Format
Output a single integer on one line, representing the length of the shortest route.
3
0 2 1
1 0 2
2 1 0
3
Hint
For all testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号