結果
| 問題 |
No.3344 Common Tangent Line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-13 23:46:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,221 ms / 3,000 ms |
| コード長 | 902 bytes |
| コンパイル時間 | 283 ms |
| コンパイル使用メモリ | 82,248 KB |
| 実行使用メモリ | 78,240 KB |
| 最終ジャッジ日時 | 2025-11-13 23:47:01 |
| 合計ジャッジ時間 | 29,357 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 40 |
ソースコード
import math
T = int(input())
def normal(t):
while 0 > t:
t += 2*math.pi
while 2*math.pi <= t:
t -= 2*math.pi
return t
for _ in range(T):
x1,y1,r1 = map(int,input().split())
x2,y2,r2 = map(int,input().split())
ans = 0
x0 = x2 - x1
y0 = y2 - y1
r0 = math.sqrt(x0**2 + y0**2)
alpha = math.atan2(x0, y0)
theta1 = math.asin((r1+r2)/r0) - alpha
theta2 = math.pi - math.asin((r1+r2)/r0) - alpha
theta3 = math.asin((r1-r2)/r0) - alpha
theta4 = math.pi - math.asin((r1-r2)/r0) - alpha
#print("alpha :",alpha)
thetas = [theta1, theta2, theta3, theta4]
for the in thetas:
X = r1*math.cos(the)
Y = r1*math.sin(the)
a = X
b = Y
c = -r1**2 - x1 * X - y1 * Y
#print(a,b,c)
M = max(abs(a), abs(b), abs(c))
ans += abs(a+b+c)/M
print(ans)