Masala #M080A

Xotira 131 MB Vaqt 2000 ms Qiyinchiligi 100 %
14

  

Perfectionist

There are n points on the plane. You can move a point from a coordinate \((x_1, y_1) \) to the coordinate \((x_2, y_2)\) за стоимость, равную  \(\sqrt{(x_1 - x_2)^2 + (y_1 - y_2) ^ 2}\)

Your task is to minimize the total cost of moving all points in such a way that they lie on the same straight line. Note that you can move the points in any way you like.
 


Kiruvchi ma'lumotlar:

The first line contains an integer \(n\) — number of points \((2 <= n <= 10^3)\). Next in \(n\)  the lines list the coordinates of these points\(x_i\)and \(y_i\) — integers, modulo not exceeding  \(10^6\)


Chiquvchi ma'lumotlar:

Print the minimum total distance to which the points should be dragged, with an absolute or relative error of no more than \(10^{-6}\)


Misollar
# input.txt output.txt
1
4
0 0
0 1
1 1
1 0
1.414214
Yechimini yuborish
Bu amalni bajarish uchun tizimga kiring, agar profilingiz bo'lmasa istalgan payt ro'yxatdan o'tishingiz mumkin