結果

問題 No.1737 One to N
ユーザー 👑 tamatotamato
提出日時 2021-11-12 21:26:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 1,579 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 79,460 KB
最終ジャッジ日時 2023-08-16 21:26:10
合計ジャッジ時間 4,415 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
79,392 KB
testcase_01 AC 72 ms
71,384 KB
testcase_02 AC 85 ms
76,852 KB
testcase_03 AC 72 ms
71,724 KB
testcase_04 AC 83 ms
76,768 KB
testcase_05 AC 109 ms
79,460 KB
testcase_06 AC 108 ms
79,196 KB
testcase_07 AC 107 ms
79,032 KB
testcase_08 AC 82 ms
76,608 KB
testcase_09 AC 83 ms
76,760 KB
testcase_10 AC 90 ms
77,140 KB
testcase_11 AC 82 ms
76,628 KB
testcase_12 AC 85 ms
76,884 KB
testcase_13 AC 92 ms
77,876 KB
testcase_14 AC 101 ms
78,452 KB
testcase_15 AC 102 ms
78,680 KB
testcase_16 AC 91 ms
77,152 KB
testcase_17 AC 90 ms
77,552 KB
testcase_18 AC 88 ms
77,280 KB
testcase_19 AC 81 ms
76,436 KB
testcase_20 AC 82 ms
76,680 KB
testcase_21 AC 96 ms
78,272 KB
testcase_22 AC 81 ms
76,344 KB
testcase_23 AC 95 ms
78,324 KB
testcase_24 AC 91 ms
77,508 KB
testcase_25 AC 87 ms
77,292 KB
testcase_26 AC 84 ms
76,856 KB
testcase_27 AC 71 ms
71,460 KB
testcase_28 AC 91 ms
77,156 KB
testcase_29 AC 73 ms
71,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())

    dp = [10 ** 9] * (N+1)
    dp[1] = 0
    for i in range(1, N):
        for j in range(2, N+1):
            if i * j > N:
                break
            dp[i * j] = min(dp[i * j], dp[i] + j)
    print(dp[N])


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