結果

問題 No.1664 Unstable f(n)
ユーザー ntuda
提出日時 2021-09-04 01:21:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 70,400 KB
最終ジャッジ日時 2024-12-15 22:10:22
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(i,j):
    if j == 0:
        return i == 1
    else:
        return N >= i ** j

N = int(input())
ans = 10 ** 18
for j in range(60):
    lb = 1
    ub = 10 ** 18
    while ub - lb > 1:
        mid = (ub + lb) // 2
        if check(mid,j):
            lb = mid
        else:
            ub = mid
    k = N - lb ** j
    ans = min(ans, j + lb + k)
print(ans)
0