結果
問題 | No.1664 Unstable f(n) |
ユーザー |
![]() |
提出日時 | 2021-09-05 16:39:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 53,248 KB |
最終ジャッジ日時 | 2024-12-21 18:09:18 |
合計ジャッジ時間 | 2,587 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
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 = n 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)