結果

問題 No.1381 Simple Geometry 1
ユーザー 👑 KazunKazun
提出日時 2021-02-07 21:06:20
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 71,640 KB
最終ジャッジ日時 2023-09-17 20:04:12
合計ジャッジ時間 4,004 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,552 KB
testcase_01 AC 73 ms
71,180 KB
testcase_02 AC 73 ms
71,356 KB
testcase_03 AC 75 ms
71,416 KB
testcase_04 AC 77 ms
71,296 KB
testcase_05 AC 73 ms
71,640 KB
testcase_06 AC 75 ms
71,360 KB
testcase_07 AC 76 ms
71,424 KB
testcase_08 AC 75 ms
71,424 KB
testcase_09 AC 73 ms
71,220 KB
testcase_10 AC 75 ms
71,392 KB
testcase_11 AC 74 ms
71,312 KB
testcase_12 AC 75 ms
71,176 KB
testcase_13 AC 74 ms
71,316 KB
testcase_14 AC 73 ms
71,232 KB
testcase_15 AC 73 ms
71,336 KB
testcase_16 AC 73 ms
71,552 KB
testcase_17 AC 73 ms
71,216 KB
testcase_18 AC 72 ms
71,488 KB
testcase_19 AC 72 ms
71,240 KB
testcase_20 AC 73 ms
71,248 KB
testcase_21 AC 72 ms
71,440 KB
testcase_22 AC 73 ms
71,232 KB
testcase_23 AC 73 ms
71,332 KB
testcase_24 AC 74 ms
71,240 KB
testcase_25 AC 73 ms
71,012 KB
testcase_26 AC 75 ms
71,388 KB
testcase_27 AC 75 ms
71,616 KB
testcase_28 AC 75 ms
71,216 KB
testcase_29 AC 74 ms
71,056 KB
testcase_30 AC 73 ms
71,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def General_Binary_Increase_Search(L,R,cond,Integer=True,ep=1/(1<<20),Times=50):
    """条件式が単調増加であるとき,一般的な二部探索を行う.
    L:解の下限
    R:解の上限
    cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす)
    Integer:解を整数に制限するか?
    ep:Integer=Falseのとき,解の許容する誤差
    """
    if not(cond(R)):
        return None

    if cond(L):
        return L

    if Integer:
        R+=1
        while R-L>1:
            C=L+(R-L)//2
            if cond(C):
                R=C
            else:
                L=C
        return R
    else:
        while (R-L)>=ep and Times:
            Times-=1
            C=L+(R-L)/2
            if cond(C):
                R=C
            else:
                L=C
        return R

from math import sqrt
def f(s):
    t=X/s
    return sqrt(s*s+Y*Y)-sqrt(t*t+Z*Z)>=W

X,Y,Z,W=map(int,input().split())
s=General_Binary_Increase_Search(0.00001,10**12,f,False,Times=100)
t=X/s
print(abs(Y*Z-s*t)/2)
0