You are to write a program which, given the positions of the villages and the number of postoffices, computes the least possible sum of all distances between each village and its nearestpost office, and the respective desired positions of the post offices.Dữ liệu vào:The first line contains two integers: the first is the number of villages V, 1 ≤ V ≤ 300, andthe second is the number of post offices P, 1 ≤ P ≤ 30, P ≤ V . The second line containsV integers in increasing order. These V integers are the positions of the villages. For eachposition X it holds that 1 ≤ X ≤ 10000.
đang được dịch, vui lòng đợi..
