結果

問題 No.1664 Unstable f(n)
ユーザー rlangevin
提出日時 2022-12-31 19:51:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 72,160 KB
最終ジャッジ日時 2024-11-26 19:17:18
合計ジャッジ時間 3,711 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(N, j):
    yes = 1
    no = 10 ** 18 + 1
    while no - yes != 1:
        mid = (yes + no)//2
        if mid ** j <= N:
            yes = mid
        else:
            no = mid
    return yes


N = int(input())
ans = 10 ** 20
for j in range(1, 65):
    i = calc(N, j)
    k = N - i ** j
    ans = min(ans, i + j + k)
print(ans)
0