結果

問題 No.1042 愚直大学
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-05-01 22:12:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 76,052 KB
最終ジャッジ日時 2023-08-26 14:19:01
合計ジャッジ時間 3,426 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,756 KB
testcase_01 AC 74 ms
75,720 KB
testcase_02 AC 74 ms
75,956 KB
testcase_03 AC 74 ms
75,580 KB
testcase_04 AC 72 ms
76,032 KB
testcase_05 AC 75 ms
75,984 KB
testcase_06 AC 76 ms
75,880 KB
testcase_07 AC 74 ms
75,852 KB
testcase_08 AC 73 ms
75,968 KB
testcase_09 AC 75 ms
75,860 KB
testcase_10 AC 75 ms
75,884 KB
testcase_11 AC 74 ms
75,852 KB
testcase_12 AC 76 ms
75,848 KB
testcase_13 AC 74 ms
75,876 KB
testcase_14 AC 75 ms
76,048 KB
testcase_15 AC 74 ms
75,920 KB
testcase_16 AC 72 ms
76,052 KB
testcase_17 AC 74 ms
75,800 KB
testcase_18 AC 74 ms
75,720 KB
testcase_19 AC 72 ms
75,800 KB
testcase_20 AC 73 ms
75,908 KB
testcase_21 AC 73 ms
75,900 KB
testcase_22 AC 74 ms
75,808 KB
testcase_23 AC 73 ms
75,924 KB
testcase_24 AC 71 ms
75,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import log2
p, q = map(int, input().split())
def bsearch(mn, mx, func):
    #func(i)=False を満たす最大のi (mn<=i<mx)
    idx = (mx + mn)/2
    for _ in range(10**5):
        if func(idx):
            idx, mx = (idx + mn)/2, idx
            continue
        idx, mn = (idx + mx)/2, idx
    return idx

def f(x):
    return x**2-(p+x*log2(x)*q) > 0

#print(f(3))
#print(f(4))
print(bsearch(1, 10**18, f))
0