#P1433. 吃奶酪

吃奶酪

Description

There are nn pieces of cheese in a room. A little mouse wants to eat them all. What is the minimum distance it must run? The mouse starts at point (0,0)(0, 0).

Input Format

The first line contains an integer nn, the number of pieces of cheese.

Lines 22 to (n+1)(n + 1) each contain two real numbers. The real numbers on the (i+1)(i + 1)-th line represent the coordinates xi,yix_i, y_i of the ii-th piece of cheese.

Output Format

Output a single real number: the minimum distance required, with 22 decimal places.

4
1 1
1 -1
-1 1
-1 -1
7.41

Hint

  • Constraints

For all test points, it is guaranteed that 1n151 \leq n \leq 15, xi,yi200|x_i|, |y_i| \leq 200, and there are at most 33 digits after the decimal point.

  • Hint

For two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), the distance formula is (x1x2)2+(y1y2)2\sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}.


2022.7.132022.7.13: A new set of Hack\text{Hack} testdata has been added.

Translated by ChatGPT 5