結果

問題 No.3181 find H
ユーザー Prala
提出日時 2025-06-13 23:15:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 884 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 82,924 KB
実行使用メモリ 61,668 KB
最終ジャッジ日時 2025-06-13 23:15:37
合計ジャッジ時間 3,801 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

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
    while abs(ok - ng) > 10**(-8):
        mid = (ok+ng)/2
        if key(mid):
            ok = mid
        else:
            ng = mid
    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))
0