Problem B
Framhjá Polli
Languages
en
is
Jörmunrekur needs to get from one place to another, but he’s not quite sure how long it’ll take him. He might not be able to walk directly between those end points since there is a large puddle he can’t step into. As we all know puddles are perfectly circular. We have his initial and desired final position, along with the size and location of the puddle. Can you figure out how far he has to walk?
Input
The input starts with four floating point numbers $-10^9 \leq x_1, y_1, x_2, y_2 \leq 10^9$. $(x_1, y_1)$ denotes Jörmunrekur’s initial position and $(x_2, y_2)$ denotes his desired final position. Next there is a line with three floating point values $-10^9 \leq x_ p, y_ p, r \leq 10^9$ where $(x_ p, y_ p)$ denotes the centre of the puddle and $r$ its radius. Neither the starting position nor the desired final position will be in the puddle. All floating point numbers in the input have at most $6$ digits after the decimal.
Output
Print the distance Jörmunrekur has to travel in the best case if he’s not allowed to step in the puddle. The answer is considered correct if the absolute or relative error is at most $10^{-5}$ with respect to the correct answer.
Sample Input 1 | Sample Output 1 |
---|---|
8 10 2 2 5 6 1.5 |
10.45346997 |
Sample Input 2 | Sample Output 2 |
---|---|
10 10 -10 10 0 0 8 |
20.0 |
Sample Input 3 | Sample Output 3 |
---|---|
-3 -3 12 4 0 0 4 |
17.77046301 |