結果

問題 No.1664 Unstable f(n)
ユーザー mkawa2mkawa2
提出日時 2021-09-03 21:35:09
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 885 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 8,564 KB
最終ジャッジ日時 2023-08-21 20:08:57
合計ジャッジ時間 2,401 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,700 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 15 ms
7,768 KB
testcase_03 AC 15 ms
7,828 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 15 ms
7,860 KB
testcase_07 AC 15 ms
7,864 KB
testcase_08 AC 15 ms
7,884 KB
testcase_09 AC 16 ms
7,888 KB
testcase_10 AC 16 ms
7,716 KB
testcase_11 AC 16 ms
7,724 KB
testcase_12 AC 16 ms
7,944 KB
testcase_13 AC 16 ms
7,724 KB
testcase_14 WA -
testcase_15 AC 16 ms
7,744 KB
testcase_16 AC 16 ms
7,752 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 16 ms
7,872 KB
testcase_21 AC 16 ms
7,764 KB
testcase_22 AC 16 ms
7,724 KB
testcase_23 AC 16 ms
7,808 KB
testcase_24 AC 16 ms
7,768 KB
testcase_25 AC 16 ms
7,720 KB
testcase_26 AC 15 ms
7,808 KB
testcase_27 AC 15 ms
7,892 KB
testcase_28 AC 16 ms
8,564 KB
testcase_29 AC 16 ms
7,716 KB
testcase_30 AC 16 ms
7,852 KB
testcase_31 AC 15 ms
7,776 KB
testcase_32 AC 15 ms
7,988 KB
testcase_33 AC 16 ms
7,900 KB
testcase_34 AC 16 ms
7,840 KB
testcase_35 AC 15 ms
7,772 KB
testcase_36 AC 16 ms
7,860 KB
testcase_37 AC 15 ms
7,788 KB
testcase_38 AC 15 ms
7,716 KB
testcase_39 AC 16 ms
7,848 KB
testcase_40 AC 16 ms
7,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**9
# md = 998244353
md = 10**9+7

n = II()
ans = inf
if n == 1:
    print(1)
else:
    for j in range(1, n+1):
        i = round(n**(1/j))+3
        while i**j>n:i-=1
        if i==1:break
        k = n-i**j
        # print(i,j,k,i+j+k)
        ans = min(ans, i+j+k)
        if i==1:break
    print(ans)
0