結果

問題 No.1176 少ない質問
ユーザー 👑 KazunKazun
提出日時 2020-08-21 21:30:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 1,000 ms
コード長 985 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 70,656 KB
最終ジャッジ日時 2024-04-23 05:30:46
合計ジャッジ時間 1,937 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
70,400 KB
testcase_01 AC 54 ms
69,888 KB
testcase_02 AC 49 ms
70,656 KB
testcase_03 AC 51 ms
70,656 KB
testcase_04 AC 49 ms
70,144 KB
testcase_05 AC 51 ms
70,400 KB
testcase_06 AC 51 ms
69,760 KB
testcase_07 AC 50 ms
69,760 KB
testcase_08 AC 49 ms
69,888 KB
testcase_09 AC 51 ms
69,888 KB
testcase_10 AC 50 ms
69,632 KB
testcase_11 AC 51 ms
69,376 KB
testcase_12 AC 51 ms
69,632 KB
testcase_13 AC 50 ms
68,992 KB
testcase_14 AC 49 ms
70,392 KB
testcase_15 AC 49 ms
70,400 KB
testcase_16 AC 50 ms
70,144 KB
testcase_17 AC 50 ms
70,016 KB
testcase_18 AC 49 ms
69,760 KB
testcase_19 AC 49 ms
69,888 KB
testcase_20 AC 38 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

M=1
N=float("inf")
Ans=float("inf")
while N>2:
    N=General_Binary_Increase_Search(0,10**18,lambda x:x**M>=A)
    Ans=min(Ans,M*N)
    M+=1
print(Ans)
0