Logo
(追記) (追記ここまで)

30951번 - Going to the Moon 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB208402823.140%

문제

Alice and Bob are playing a game in the sand outside their mansion. A circle representing the Moon is drawn somewhere, and they each also pick a place to stand (inside, on the edge, or outside the Moon). The goal of the game is that one of the players runs to the other as fast as possible, while also touching the Moon during the run.

Given the positions of the Moon, Alice, and Bob, find the length of the shortest path that starts at one of the players, touches (or crosses) the edge or the interior of the Moon, and ends at the position of the other player.

입력

The first line contains an integer $T,ドル the number of test cases. It's followed by $T$ lines, each containing 7 space-separated integers $x_A,ドル $y_A,ドル $x_B,ドル $y_B,ドル $x_C,ドル $y_C,ドル $r,ドル representing coordinates of Alice, $A = (x_A, y_A),ドル Bob, $B = (x_B, y_B),ドル the center of the circle, $C = (x_C, y_C),ドル and its radius $r$.

출력

For each test case output a single decimal number representing the length of the shortest path from $A$ to $B$ that also touches at least one point inside or on the edge of a circle with the center $C$ and radius $r$. The solution will be considered correct if the relative or absolute error compared to the official solution is within 10ドル^{-6}$.

제한

  • 1ドル \leq T \leq 10^3$
  • $-10^3 \leq x_A, y_A, x_B, y_B, x_C, y_C \leq 10^3$
  • 0ドル \leq r \leq 10^3$

예제 입력 1

2
0 0 2 0 -1 2 1
5 0 3 0 2 0 2

예제 출력 1

3.9451754612261913
2

힌트

The solution for the first test case is shown in the picture.

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2023 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /