QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 512 MB Total points: 100

#972. 원

Statistics

좌표평면 위에 두 점 $A$와 $B$, 그리고 장애물 원 $O$가 있다.

이제 원 $O$의 경계 위의 한 점 $C$를 선택하여 점 $A$와 점 $B$를 모두 점 $C$로 이동시켜야 한다. 이동하는 동안 점 $A$와 점 $B$의 경로는 원 $O$의 외부로만 지나가거나 원의 경계에 닿을 수 있다.

우리의 목표는 총 이동 거리, 즉 점 $A$와 점 $B$의 이동 거리의 합을 최소화하는 것이다.

입력

첫 번째 줄에는 테스트 케이스의 수 $t$ ($1 \le t \le 10^6$)가 주어진다.

각 테스트 케이스는 한 줄에 일곱 개의 정수 $x_1, y_1, x_2, y_2, x_3, y_3, r$로 주어지며, $-10^3 \le x_1, y_1, x_2, y_2, x_3, y_3 \le 10^3$이고 $1 \le r \le 10^3$이다. 여기서 $A = (x_1, y_1)$, $B = (x_2, y_2)$이고, $O$는 중심이 $(x_3, y_3)$이고 반지름이 $r$인 원이다. 점 $A$와 점 $B$는 원 $O$의 내부에 있지 않음이 보장된다.

출력

각 테스트 케이스마다 소수점 셋째 자리까지 반올림한 실수 하나를 한 줄에 출력한다.

소수점 넷째 자리는 4도 아니고 5도 아님이 보장된다.

예제

입력 1

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

출력 1

3.571
2.927
3.116

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.