P6039 "ACOI2020" Speed of Sound.
Background

Teacher Tadaomi Karasuma from the Ministry of Defense came to Kunugigaoka Junior High School and gave the students of Class 3-E an important mission: assassinate a super creature (named Koro-sensei by Kaede Kayano) within one year. So the students began training hard. But soon, Koro-sensei showed his ability: he can fly continuously at an ultra-high speed of 20 Mach, so the students could not even touch him. Therefore, they decided to buy a teleporter from Karasuma.
Description
Now the students are ambushing in the back mountain. They are very familiar with the terrain, and the back mountain is wide enough to be regarded as an infinite 2D Cartesian coordinate plane. The students are at $(0,0)$. At this moment, Koro-sensei is at $(x,y)$, seriously reading a “little yellow book” left by Taiga Okajima. The students can draw a circle centered at themselves with radius $r$, then throw the teleporter so that it lands at a point $S$ on the circle. At the landing point, the teleporter can create a line $PQ$ tangent to that circle. Now this line is the teleporter.
The teleporter works as follows: it teleports the students to the point symmetric to where they stand with respect to $PQ$. Also, they must **move after teleporting** to reach Koro-sensei’s position to attack him. After seeing their plan, Karasuma was very impressed, but he has two questions for the students:
- After using the teleporter, what is the minimum distance they need to move?
- Under the plan that guarantees the minimum movement distance, what is the value of $\tan$ of the angle between $PQ$ and the $x$-axis? We consider the angle to be in $[0,180]^\circ$.
Input Format
The first line contains two real numbers $x,y$, indicating the positions of Koro-sensei and the little yellow book, with meaningless trailing $0$ automatically removed.
The second line contains one real number $r$, with the meaning described above.
Output Format
On the first line, output the minimum distance they need to move after using the teleporter, **rounded to 6 decimal places**.
On the second line, under the plan that guarantees the minimum movement distance, output the value of $\tan$ of the angle between $PQ$ and the $x$-axis, **rounded to 2 decimal places**.
In particular, when the $\tan$ value is undefined, output ```Error```. Otherwise, if multiple angles can satisfy the condition, output the smallest $\tan$ value. You may treat ```Error``` as $+\infty$.
**Note: when $\tan$ is negative, treat this $\tan$ value as $+\infty$. The angle refers to the acute angle.**
Explanation/Hint
#### Constraints
**This problem uses bundled testdata**.
- Subtask 1 (10 points): $x,y,r$ satisfy $x^2+y^2=r^2$.
- Subtask 2 (20 points): at least one of $x,y$ is $0$.
- Subtask 3 (70 points): no special constraints on the data.
For $100\%$ of the data, $0 \leq |x|,|y|,r \leq 10^{10}$.
---
#### Hint
1. **This problem includes an SPJ**. If the absolute difference between the answer to the first question and the standard answer is at most $10^{-6}$, you can get $50\%$ of the score for that test point. When the answer to the first question is correct:
- If the answer to the second question is not ```Error```, you can get full score for that test point when the absolute difference between your output and the standard answer is at most $10^{-2}$.
- If the answer to the second question is ```Error```, only outputting ```Error``` can get full score for that test point.
**Because the SPJ is sensitive, if you can only answer the first question, please output any value on the second line, and do not output `Error`.**
2. The $\tan$ value means: in a **right triangle**, the ratio of the length of the leg opposite an angle to the length of the leg adjacent to it. For example, $\tan\ 45^\circ = 1$. In particular, $\tan$ at $90^\circ$ is **undefined**.
3. A line that has exactly one common intersection point with a circle is called a **tangent line** of the circle. The radius connecting the tangency point and the circle center is **perpendicular** to the tangent line.
Translated by ChatGPT 5