結果

問題 No.1664 Unstable f(n)
コンテスト
ユーザー ntuda
提出日時 2021-09-04 01:21:11
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 39 ms / 2,000 ms
+ 173µs
コード長 366 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 78 ms
コンパイル使用メモリ 65,192 KB
実行使用メモリ 58,532 KB
最終ジャッジ日時 2026-10-20 01:58:43
合計ジャッジ時間 4,492 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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