#P9405. Sum of Euclidean Distances for Each Point
Sum of Euclidean Distances for Each Point
Sum of Euclidean Distances for Each Point
Given n points on a 2D plane, for each point, calculate the sum of its Euclidean distances to all other points. The Euclidean distance between two points ((x_1,y_1)) and ((x_2,y_2)) is given by [ d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} ] Your answer for each point must have a relative error of no more than 0.1%.
inputFormat
The first line contains an integer n, the number of points. Each of the following n lines contains two real numbers representing the coordinates of a point. For example:
3 0 0 3 4 6 8
outputFormat
Output n lines, where the i-th line is the sum of the Euclidean distances from the i-th point to all other points. Each number should be printed with at least 6 decimal places.
sample
3
0 0
3 4
6 8
15.000000
10.000000
15.000000
</p>