#P6039. 「ACOI2020」音速

「ACOI2020」音速

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)(0,0). At this moment, Koro-sensei is at (x,y)(x,y), seriously reading a “little yellow book” left by Taiga Okajima. The students can draw a circle centered at themselves with radius rr, then throw the teleporter so that it lands at a point SS on the circle. At the landing point, the teleporter can create a line PQPQ 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 PQPQ. 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\tan of the angle between PQPQ and the xx-axis? We consider the angle to be in [0,180][0,180]^\circ.

Input Format

The first line contains two real numbers x,yx,y, indicating the positions of Koro-sensei and the little yellow book, with meaningless trailing 00 automatically removed.
The second line contains one real number rr, 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\tan of the angle between PQPQ and the xx-axis, rounded to 2 decimal places.

In particular, when the tan\tan value is undefined, output Error. Otherwise, if multiple angles can satisfy the condition, output the smallest tan\tan value. You may treat Error as ++\infty.

Note: when tan\tan is negative, treat this tan\tan value as ++\infty. The angle refers to the acute angle.

11 0
5

1.000000
Error
6 8
4

2.000000
0.75

Hint

Constraints

This problem uses bundled testdata.

  • Subtask 1 (10 points): x,y,rx,y,r satisfy x2+y2=r2x^2+y^2=r^2.
  • Subtask 2 (20 points): at least one of x,yx,y is 00.
  • Subtask 3 (70 points): no special constraints on the data.

For 100%100\% of the data, 0x,y,r10100 \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 10610^{-6}, you can get 50%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 10210^{-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.
  1. The tan\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=1\tan\ 45^\circ = 1. In particular, tan\tan at 9090^\circ is undefined.

  2. 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