結果

問題 No.1664 Unstable f(n)
ユーザー siro53siro53
提出日時 2021-09-03 22:06:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 76,116 KB
最終ジャッジ日時 2023-08-21 22:00:45
合計ジャッジ時間 5,015 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,384 KB
testcase_01 AC 80 ms
75,920 KB
testcase_02 AC 74 ms
75,504 KB
testcase_03 AC 69 ms
71,172 KB
testcase_04 AC 70 ms
71,136 KB
testcase_05 AC 71 ms
71,056 KB
testcase_06 AC 69 ms
71,244 KB
testcase_07 AC 70 ms
71,056 KB
testcase_08 AC 69 ms
71,172 KB
testcase_09 AC 70 ms
71,128 KB
testcase_10 AC 69 ms
71,164 KB
testcase_11 AC 80 ms
75,924 KB
testcase_12 AC 83 ms
76,052 KB
testcase_13 AC 84 ms
76,036 KB
testcase_14 AC 82 ms
76,116 KB
testcase_15 AC 81 ms
75,992 KB
testcase_16 AC 85 ms
76,056 KB
testcase_17 AC 84 ms
75,920 KB
testcase_18 AC 86 ms
76,064 KB
testcase_19 AC 87 ms
76,064 KB
testcase_20 AC 83 ms
76,004 KB
testcase_21 AC 79 ms
76,040 KB
testcase_22 AC 80 ms
75,760 KB
testcase_23 AC 77 ms
75,932 KB
testcase_24 AC 77 ms
75,620 KB
testcase_25 AC 79 ms
75,760 KB
testcase_26 AC 73 ms
75,560 KB
testcase_27 AC 74 ms
75,500 KB
testcase_28 AC 74 ms
75,616 KB
testcase_29 AC 76 ms
75,364 KB
testcase_30 AC 74 ms
75,564 KB
testcase_31 AC 76 ms
75,872 KB
testcase_32 AC 80 ms
76,004 KB
testcase_33 AC 78 ms
75,964 KB
testcase_34 AC 76 ms
75,780 KB
testcase_35 AC 85 ms
75,996 KB
testcase_36 AC 79 ms
75,752 KB
testcase_37 AC 80 ms
76,052 KB
testcase_38 AC 71 ms
75,364 KB
testcase_39 AC 79 ms
76,084 KB
testcase_40 AC 79 ms
76,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import sqrt

input = sys.stdin.readline

n = int(input())
ans = n
# j = 2
m = int(sqrt(n))
for i in range(max(m-100000, 0), min(m+100001, n)):
    if i > 0 and i*i <= n:
        ans = min(ans, i + 2 + (n - i * i))
# j >= 3
for j in range(3, 61):
    if 2**j > n:
        break
    i = 2
    while True:
        if i ** j > n:
            break
        k = n - i**j
        ans = min(ans, i + j + k)
        i += 1
print(ans)
0