結果

問題 No.1381 Simple Geometry 1
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-04 14:00:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 72,020 KB
最終ジャッジ日時 2023-09-29 19:23:17
合計ジャッジ時間 3,912 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,992 KB
testcase_01 AC 71 ms
71,600 KB
testcase_02 AC 73 ms
71,976 KB
testcase_03 AC 72 ms
71,824 KB
testcase_04 AC 72 ms
71,916 KB
testcase_05 AC 72 ms
71,732 KB
testcase_06 AC 73 ms
71,732 KB
testcase_07 AC 74 ms
71,624 KB
testcase_08 AC 73 ms
71,788 KB
testcase_09 AC 72 ms
71,824 KB
testcase_10 AC 73 ms
71,392 KB
testcase_11 AC 72 ms
71,844 KB
testcase_12 AC 73 ms
71,828 KB
testcase_13 AC 73 ms
71,508 KB
testcase_14 AC 72 ms
71,600 KB
testcase_15 AC 73 ms
71,656 KB
testcase_16 AC 73 ms
71,764 KB
testcase_17 AC 73 ms
71,612 KB
testcase_18 AC 72 ms
71,596 KB
testcase_19 AC 74 ms
72,016 KB
testcase_20 AC 73 ms
71,568 KB
testcase_21 AC 73 ms
71,752 KB
testcase_22 AC 72 ms
71,628 KB
testcase_23 AC 73 ms
71,632 KB
testcase_24 AC 73 ms
71,796 KB
testcase_25 AC 73 ms
71,732 KB
testcase_26 AC 73 ms
71,632 KB
testcase_27 AC 73 ms
72,020 KB
testcase_28 AC 73 ms
71,560 KB
testcase_29 AC 73 ms
72,020 KB
testcase_30 AC 73 ms
71,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x, y, z, w = map(int, input().split())

def is_ok(k):
    p = ((k+w)**2-y**2)*(k**2-z**2)
    return p >= x**2
ng = 0
ok = 2*x
while abs(ng-ok) > 10**(-9):
    mid = (ng+ok)/2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
k = ok
import math
a = math.sqrt((k+w)**2-y**2)
b = math.sqrt(k**2-z**2)
ans = x-y*a/2-b*z/2-(b-y)*(a-z)/2
print(ans)
0