結果

問題 No.1664 Unstable f(n)
ユーザー asumo0729asumo0729
提出日時 2021-09-03 21:35:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 864 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 63,744 KB
最終ジャッジ日時 2024-05-09 02:13:08
合計ジャッジ時間 3,470 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
58,624 KB
testcase_01 AC 49 ms
59,648 KB
testcase_02 AC 47 ms
59,648 KB
testcase_03 AC 44 ms
58,368 KB
testcase_04 AC 44 ms
58,624 KB
testcase_05 AC 44 ms
58,240 KB
testcase_06 AC 49 ms
59,008 KB
testcase_07 AC 45 ms
58,368 KB
testcase_08 AC 44 ms
59,008 KB
testcase_09 AC 47 ms
58,368 KB
testcase_10 AC 45 ms
58,240 KB
testcase_11 AC 52 ms
62,208 KB
testcase_12 AC 51 ms
61,952 KB
testcase_13 AC 53 ms
62,720 KB
testcase_14 AC 54 ms
63,744 KB
testcase_15 AC 49 ms
60,672 KB
testcase_16 AC 51 ms
62,464 KB
testcase_17 AC 49 ms
60,672 KB
testcase_18 AC 52 ms
63,104 KB
testcase_19 AC 49 ms
60,800 KB
testcase_20 AC 49 ms
60,800 KB
testcase_21 AC 48 ms
59,776 KB
testcase_22 AC 48 ms
60,032 KB
testcase_23 AC 47 ms
59,776 KB
testcase_24 AC 48 ms
60,288 KB
testcase_25 AC 49 ms
60,032 KB
testcase_26 AC 49 ms
59,904 KB
testcase_27 AC 49 ms
60,800 KB
testcase_28 AC 48 ms
60,160 KB
testcase_29 AC 48 ms
59,904 KB
testcase_30 AC 49 ms
60,288 KB
testcase_31 AC 48 ms
59,776 KB
testcase_32 AC 52 ms
62,976 KB
testcase_33 AC 47 ms
59,264 KB
testcase_34 AC 49 ms
60,544 KB
testcase_35 AC 50 ms
61,184 KB
testcase_36 AC 47 ms
59,392 KB
testcase_37 AC 49 ms
60,800 KB
testcase_38 AC 48 ms
59,648 KB
testcase_39 AC 49 ms
60,288 KB
testcase_40 AC 48 ms
60,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
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 i in range(60):
    if i == 0:
        ans = min(ans, n)
    else:
        ok = 1
        ng = inf
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            temp = 1
            now = 0
            while now < i:
                temp *= mid
                if temp > n:
                    break
                now += 1
                
            if now == i:
                ok = mid
            else:
                ng = mid

        res = n - ok ** i + ok + i
        ans = min(ans, res)

print(ans)
0