結果

問題 No.1737 One to N
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-12 21:26:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 1,550 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 78,032 KB
最終ジャッジ日時 2023-08-16 21:27:47
合計ジャッジ時間 5,434 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
78,032 KB
testcase_01 AC 70 ms
70,900 KB
testcase_02 AC 87 ms
76,220 KB
testcase_03 AC 71 ms
70,972 KB
testcase_04 AC 80 ms
76,060 KB
testcase_05 AC 110 ms
77,952 KB
testcase_06 AC 109 ms
77,808 KB
testcase_07 AC 105 ms
77,844 KB
testcase_08 AC 84 ms
75,756 KB
testcase_09 AC 85 ms
75,804 KB
testcase_10 AC 93 ms
76,620 KB
testcase_11 AC 84 ms
76,028 KB
testcase_12 AC 86 ms
76,288 KB
testcase_13 AC 94 ms
76,952 KB
testcase_14 AC 101 ms
77,160 KB
testcase_15 AC 105 ms
77,360 KB
testcase_16 AC 89 ms
76,264 KB
testcase_17 AC 90 ms
76,568 KB
testcase_18 AC 89 ms
76,556 KB
testcase_19 AC 84 ms
75,860 KB
testcase_20 AC 81 ms
75,892 KB
testcase_21 AC 96 ms
77,140 KB
testcase_22 AC 83 ms
75,928 KB
testcase_23 AC 97 ms
77,088 KB
testcase_24 AC 91 ms
76,628 KB
testcase_25 AC 89 ms
76,448 KB
testcase_26 AC 82 ms
75,820 KB
testcase_27 AC 69 ms
70,904 KB
testcase_28 AC 93 ms
76,528 KB
testcase_29 AC 71 ms
70,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
INF =10**18
dp = [INF]*(n+1)
dp[1] = 0
for i in range(1, n):
    k = 2
    j = k*i
    while j <= n:
        dp[j] = min(dp[j], dp[i]+k)
        k += 1
        j = k*i
print(dp[n])
0