結果

問題 No.1664 Unstable f(n)
ユーザー asumo0729asumo0729
提出日時 2021-09-03 21:35:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 864 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 76,160 KB
最終ジャッジ日時 2023-08-21 20:10:10
合計ジャッジ時間 5,581 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
75,800 KB
testcase_01 AC 88 ms
76,040 KB
testcase_02 AC 88 ms
76,096 KB
testcase_03 AC 84 ms
75,924 KB
testcase_04 AC 84 ms
75,816 KB
testcase_05 AC 86 ms
75,620 KB
testcase_06 AC 85 ms
75,728 KB
testcase_07 AC 86 ms
75,544 KB
testcase_08 AC 87 ms
75,892 KB
testcase_09 AC 88 ms
75,688 KB
testcase_10 AC 87 ms
75,776 KB
testcase_11 AC 93 ms
75,852 KB
testcase_12 AC 93 ms
76,004 KB
testcase_13 AC 91 ms
75,808 KB
testcase_14 AC 94 ms
75,884 KB
testcase_15 AC 91 ms
75,960 KB
testcase_16 AC 91 ms
75,852 KB
testcase_17 AC 89 ms
75,856 KB
testcase_18 AC 92 ms
75,984 KB
testcase_19 AC 88 ms
76,160 KB
testcase_20 AC 89 ms
75,900 KB
testcase_21 AC 88 ms
75,672 KB
testcase_22 AC 87 ms
75,876 KB
testcase_23 AC 87 ms
75,828 KB
testcase_24 AC 88 ms
75,880 KB
testcase_25 AC 89 ms
75,844 KB
testcase_26 AC 88 ms
75,816 KB
testcase_27 AC 88 ms
76,012 KB
testcase_28 AC 89 ms
75,920 KB
testcase_29 AC 87 ms
75,812 KB
testcase_30 AC 89 ms
75,836 KB
testcase_31 AC 87 ms
75,588 KB
testcase_32 AC 92 ms
75,656 KB
testcase_33 AC 87 ms
75,772 KB
testcase_34 AC 88 ms
75,864 KB
testcase_35 AC 90 ms
75,792 KB
testcase_36 AC 87 ms
75,680 KB
testcase_37 AC 89 ms
75,888 KB
testcase_38 AC 87 ms
75,788 KB
testcase_39 AC 89 ms
75,644 KB
testcase_40 AC 88 ms
75,920 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