The question is to give v villages and take P as the post office, which requires the minimum distance from each village to the post office.
First, consider that there is only one post office, no matter how you put the post office or the minimum situation is always at the point.
Consider the case where p> 1:
Assuming that the post offices in the P-1 have been selected, the last one is minimized by selecting one of the remaining unselected villages.
There is a recursive formula: M [v] [p] = min {M [I] [P-1] + dis [I + 1] [v]}
M [I] [P-1] indicates the minimum distance and the P-1 post office in the previous village. The p-1 <= I <= V;
Dis [I + 1] [v] indicates selecting a village from I + 1 to minimize the distance (I + 1, v) from the village to the village, that is, to resolve
Only one post office is under consideration (it must have been in the middle ).
Note: The post office that is added later is always placed at the midpoint of (I + 1, V). Dis [I + 1] [v] indicates (I + 1, v) to the sum of the centers.
At first, I thought that I + 1 was not necessarily closest to the newly added post office, then Min [I] [P-1] + dis [I + 1] [v] is not the smallest sum.
However, although the sum obtained in this way is not the smallest, the smallest sum will be obtained in the next solution process, so the result will not be affected.
Poj post 1160