結果

問題 No.1042 愚直大学
ユーザー 👑 KazunKazun
提出日時 2020-12-09 18:13:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 933 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 64,104 KB
最終ジャッジ日時 2023-10-19 05:03:40
合計ジャッジ時間 3,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,784 KB
testcase_01 AC 39 ms
53,772 KB
testcase_02 AC 38 ms
53,772 KB
testcase_03 AC 38 ms
53,772 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def General_Binary_Decrease_Search(L,R,cond,Integer=True,ep=1/(1<<20)):
    """条件式が単調減少であるとき,一般的な二部探索を行う.
    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:
            C=L+(R-L)/2
            if cond(C):
                L=C
            else:
                R=C
        return L

from math import log
P,Q=map(int,input().split())
print(General_Binary_Decrease_Search(1,10**18,lambda x:x*x<P+Q*x*log(x,2),False,10**(-6)))
0