結果

問題 No.1737 One to N
ユーザー Shirapon_ponShirapon_pon
提出日時 2021-11-29 11:42:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 207 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 79,192 KB
最終ジャッジ日時 2023-09-15 04:15:39
合計ジャッジ時間 5,442 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
79,128 KB
testcase_01 AC 73 ms
71,144 KB
testcase_02 AC 92 ms
76,564 KB
testcase_03 AC 72 ms
71,368 KB
testcase_04 AC 88 ms
76,712 KB
testcase_05 AC 116 ms
79,084 KB
testcase_06 AC 118 ms
79,192 KB
testcase_07 AC 121 ms
78,628 KB
testcase_08 AC 90 ms
76,280 KB
testcase_09 AC 91 ms
76,320 KB
testcase_10 AC 97 ms
77,492 KB
testcase_11 AC 91 ms
76,496 KB
testcase_12 AC 94 ms
76,984 KB
testcase_13 AC 101 ms
77,516 KB
testcase_14 AC 108 ms
78,544 KB
testcase_15 AC 111 ms
78,872 KB
testcase_16 AC 96 ms
77,260 KB
testcase_17 AC 96 ms
77,308 KB
testcase_18 AC 97 ms
77,192 KB
testcase_19 AC 88 ms
76,444 KB
testcase_20 AC 89 ms
76,328 KB
testcase_21 AC 102 ms
77,780 KB
testcase_22 AC 87 ms
76,460 KB
testcase_23 AC 103 ms
77,544 KB
testcase_24 AC 98 ms
77,128 KB
testcase_25 AC 92 ms
77,064 KB
testcase_26 AC 87 ms
76,708 KB
testcase_27 AC 74 ms
71,232 KB
testcase_28 AC 96 ms
77,340 KB
testcase_29 AC 72 ms
71,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
dp = [i for i in range(n+1)]
dp[1] = 0

for i in range(2,n+1):
    k = 2
    for k in range(2,n+1):
        if i*k > n:
            break
        dp[i*k] = min(dp[i*k],dp[i]+k)

print(dp[n])
0