結果

問題 No.1664 Unstable f(n)
ユーザー kimiyukikimiyuki
提出日時 2021-09-03 22:45:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2023-08-21 23:48:02
合計ジャッジ時間 2,700 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
7,940 KB
testcase_01 AC 25 ms
8,076 KB
testcase_02 AC 25 ms
8,032 KB
testcase_03 AC 15 ms
7,900 KB
testcase_04 AC 24 ms
7,900 KB
testcase_05 AC 26 ms
7,952 KB
testcase_06 AC 24 ms
7,952 KB
testcase_07 AC 24 ms
8,072 KB
testcase_08 AC 25 ms
8,076 KB
testcase_09 AC 25 ms
7,988 KB
testcase_10 AC 25 ms
7,864 KB
testcase_11 AC 25 ms
7,864 KB
testcase_12 AC 25 ms
7,936 KB
testcase_13 AC 25 ms
7,860 KB
testcase_14 AC 26 ms
8,048 KB
testcase_15 AC 26 ms
7,896 KB
testcase_16 AC 26 ms
8,052 KB
testcase_17 AC 25 ms
7,948 KB
testcase_18 AC 25 ms
7,876 KB
testcase_19 AC 25 ms
8,000 KB
testcase_20 AC 25 ms
7,912 KB
testcase_21 AC 25 ms
7,876 KB
testcase_22 AC 25 ms
7,936 KB
testcase_23 AC 25 ms
7,976 KB
testcase_24 AC 25 ms
7,872 KB
testcase_25 AC 25 ms
7,864 KB
testcase_26 AC 25 ms
7,864 KB
testcase_27 AC 25 ms
8,028 KB
testcase_28 AC 24 ms
7,872 KB
testcase_29 AC 24 ms
7,972 KB
testcase_30 AC 25 ms
8,076 KB
testcase_31 AC 25 ms
7,868 KB
testcase_32 AC 25 ms
7,872 KB
testcase_33 AC 25 ms
7,988 KB
testcase_34 AC 25 ms
8,024 KB
testcase_35 AC 25 ms
8,060 KB
testcase_36 AC 25 ms
8,052 KB
testcase_37 AC 25 ms
8,028 KB
testcase_38 AC 25 ms
7,864 KB
testcase_39 AC 25 ms
7,868 KB
testcase_40 AC 25 ms
7,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *
import math

def solve(n: int) -> int:
    if n == 1:
        return 1
    ans = n
    for j in range(1, 100):
        i0 = int(math.pow(n, 1/j))
        for i in range(i0 - 100, i0 + 100):
            k = n - i ** j
            if i >= 1 and j >= 0 and k >= 0:
                ans = min(ans, i + j + k)
    return ans



# generated by oj-template v4.8.0 (https://github.com/online-judge-tools/template-generator)
def main():
    n = int(input())
    a = solve(n)
    print(a)


if __name__ == '__main__':
    main()
0