結果

問題 No.948 Bomb vs Dush
ユーザー 👑 KazunKazun
提出日時 2021-02-25 04:30:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 1,193 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,616 KB
実行使用メモリ 53,812 KB
最終ジャッジ日時 2023-10-25 09:14:22
合計ジャッジ時間 3,867 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,812 KB
testcase_01 AC 39 ms
53,812 KB
testcase_02 AC 39 ms
53,812 KB
testcase_03 AC 39 ms
53,812 KB
testcase_04 AC 39 ms
53,812 KB
testcase_05 AC 39 ms
53,812 KB
testcase_06 AC 39 ms
53,812 KB
testcase_07 AC 40 ms
53,812 KB
testcase_08 AC 38 ms
53,812 KB
testcase_09 AC 39 ms
53,812 KB
testcase_10 AC 38 ms
53,812 KB
testcase_11 AC 38 ms
53,812 KB
testcase_12 AC 39 ms
53,812 KB
testcase_13 AC 38 ms
53,812 KB
testcase_14 AC 39 ms
53,812 KB
testcase_15 AC 39 ms
53,812 KB
testcase_16 AC 39 ms
53,812 KB
testcase_17 AC 38 ms
53,812 KB
testcase_18 AC 39 ms
53,812 KB
testcase_19 AC 39 ms
53,812 KB
testcase_20 AC 39 ms
53,812 KB
testcase_21 AC 39 ms
53,812 KB
testcase_22 AC 39 ms
53,812 KB
testcase_23 AC 39 ms
53,812 KB
testcase_24 AC 39 ms
53,812 KB
testcase_25 AC 38 ms
53,812 KB
testcase_26 AC 38 ms
53,812 KB
testcase_27 AC 39 ms
53,812 KB
testcase_28 AC 38 ms
53,812 KB
testcase_29 AC 39 ms
53,812 KB
testcase_30 AC 39 ms
53,812 KB
testcase_31 AC 39 ms
53,812 KB
testcase_32 AC 38 ms
53,812 KB
testcase_33 AC 39 ms
53,812 KB
testcase_34 AC 39 ms
53,812 KB
testcase_35 AC 39 ms
53,812 KB
testcase_36 AC 39 ms
53,812 KB
testcase_37 AC 39 ms
53,812 KB
testcase_38 AC 39 ms
53,812 KB
testcase_39 AC 39 ms
53,812 KB
testcase_40 AC 39 ms
53,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    if not(cond(L)):
        return None

    if cond(R):
        return R

    if Integer:
        L-=1
        while R-L>1:
            C=L+(R-L)//2
            if cond(C):
                L=C
            else:
                R=C
        return L
    else:
        while (R-L)>=ep and Times:
            Times-=1
            C=L+(R-L)/2
            if cond(C):
                L=C
            else:
                R=C
        return L
#================================================
def check(t):
    x=R-R*cos(t)
    y=0-R*sin(t)
    return x*x+y*y>=(2*r)**2
#================================================
from math import pi,sin,cos
r=float(input())
R=float(input())

T=General_Binary_Decrease_Search(pi,2*pi,check,False,pow(10,-7),1000)
print(T)

S=r*r*pi+((R+r)**2-(R-r)**2)*T/2
print(S)
0