結果

問題 No.1664 Unstable f(n)
ユーザー asumo0729
提出日時 2021-09-05 16:37:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 53,248 KB
最終ジャッジ日時 2024-12-21 18:09:07
合計ジャッジ時間 2,861 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
import math
stdin=sys.stdin
sys.setrecursionlimit(10 ** 8)

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
inf = 1 << 60
eps = 1e-9
sortkey = itemgetter(0)

n = ip()
ans = inf

for j in range(1,int(math.log2(n)) + 1):
    i = int(pow(n, (1.0 / j)))
    while pow(i,j) <= n:
        i += 1
    i -= 1
    k = n - i ** j
    ans = min(ans, i + j + k)

print(ans)
0