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.