結果
| 問題 |
No.3181 find H
|
| コンテスト | |
| ユーザー |
Prala
|
| 提出日時 | 2025-06-13 23:16:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 933 bytes |
| コンパイル時間 | 204 ms |
| コンパイル使用メモリ | 82,316 KB |
| 実行使用メモリ | 65,896 KB |
| 最終ジャッジ日時 | 2025-06-14 23:40:41 |
| 合計ジャッジ時間 | 3,438 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 50 RE * 1 |
ソースコード
import math
def IM(): return map(int, input().split())
def IL()->list[int]: return [int(i) for i in input().split()]
R, Gx, Gy = IM()
r = math.sqrt(Gx**2 + Gy**2)
b = (3*r-R)/2
a = math.sqrt(R**2 - b**2)
s = b+(a**2/(R-b))
#print(s)
if s < 10**(-9):
s = 0
if Gy == 0:
print(s, 0)
exit()
def keyfunc(n:float)->bool:
global Gx, Gy
ans_x = n
ans_y = ans_x/(Gx/Gy)
if math.sqrt(ans_x**2+ans_y**2) > abs(s):
return True
return False
def binary_search(key = keyfunc, MX = 2**62+2**61)->int:
ng = -10**(-8)
ok = MX
index = 0
while abs(ok - ng) > 10**(-8) and index < 100:
mid = (ok+ng)/2
if key(mid):
ok = mid
else:
ng = mid
index += 1
return ok
binary_ans = binary_search()
if (s >= 0 and Gx >= 0) or (s <= 0 and Gx <= 0):
print(binary_ans, binary_ans/(Gx/Gy))
else:
print(-binary_ans, -binary_ans/(Gx/Gy))
Prala