Universal Cup Judging System

Universal Cup

Límite de tiempo: 1.0 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓
Estadísticas

地球を3次元ユークリッド空間における中心 $(0, 0, 0)$、半径 $r$ の球体とします。ある飛行機が、地球の表面上を出発地点から目的地まで最短経路で飛行しています。

航空ファンであるあなたは、飛行機から距離 $d$ 以内の信号を受信できる受信機を持っています。ここで、2点間の距離は地球の表面上の最短経路(大圏距離)で測定されるものであり、3次元ユークリッド空間における直線距離ではないことに注意してください。あなたの位置にいる受信機で、飛行中のある瞬間に信号を受信できるような最小の $d$ を求めてください。

入力

入力は複数のテストケースから構成されます。最初の行にはテストケースの数を示す整数 $T$ ($1 \le T \le 10^4$) が含まれます。各テストケースは以下の通りです。

1行目には、地球の半径を示す整数 $r$ ($1 \le r \le 100$) が含まれます。

2行目には、あなたの位置の座標 $\left( \frac{ra}{\sqrt{a^2+b^2+c^2}}, \frac{rb}{\sqrt{a^2+b^2+c^2}}, \frac{rc}{\sqrt{a^2+b^2+c^2}} \right)$ を示す3つの整数 $a, b, c$ ($-100 \le a, b, c \le 100, a^2+b^2+c^2 > 0$) が含まれます。

3行目には、出発地点の座標 $\left( \frac{ru}{\sqrt{u^2+v^2+w^2}}, \frac{rv}{\sqrt{u^2+v^2+w^2}}, \frac{rw}{\sqrt{u^2+v^2+w^2}} \right)$ を示す3つの整数 $u, v, w$ ($-100 \le u, v, w \le 100, u^2+v^2+w^2 > 0$) が含まれます。

4行目には、目的地の座標 $\left( \frac{rx}{\sqrt{x^2+y^2+z^2}}, \frac{ry}{\sqrt{x^2+y^2+z^2}}, \frac{rz}{\sqrt{x^2+y^2+z^2}} \right)$ を示す3つの整数 $x, y, z$ ($-100 \le x, y, z \le 100, x^2+y^2+z^2 > 0$) が含まれます。

出発地点と目的地は一致せず、また地球上で正反対の位置にあることはないことが保証されています。したがって、地球表面上の出発地点から目的地までの最短経路は一意に定まります。

出力

各テストケースについて、受信機で信号を受信できるような最小の $d$ を表す実数を1行で出力してください。

出力は、絶対誤差または相対誤差が $10^{-4}$ 以下であれば正解とみなされます。厳密には、あなたの出力を $a$、正解を $b$ としたとき、$\frac{|a-b|}{\max(1, |b|)} \le 10^{-4}$ を満たせば正解となります。

入出力例

入力 1

2
100
1 1 1
1 0 0
0 1 0
100
-1 -1 0
1 0 0
0 1 0

出力 1

61.547970867038734110
235.619449019234492887

注記

以下の図は最初のサンプルケースを示しており、$P$ はあなたの位置、$S$ は出発地点、$T$ は目的地を表しています。

最初のサンプルケースの図

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.