結果

問題 No.555 世界史のレポート
ユーザー 👑 rin204rin204
提出日時 2022-07-09 16:05:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 77,148 KB
最終ジャッジ日時 2023-08-29 23:30:44
合計ジャッジ時間 3,543 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,552 KB
testcase_01 AC 67 ms
71,324 KB
testcase_02 AC 73 ms
71,496 KB
testcase_03 AC 73 ms
75,848 KB
testcase_04 AC 75 ms
75,852 KB
testcase_05 AC 77 ms
75,920 KB
testcase_06 AC 75 ms
76,824 KB
testcase_07 AC 77 ms
76,632 KB
testcase_08 AC 77 ms
76,636 KB
testcase_09 AC 77 ms
76,648 KB
testcase_10 AC 86 ms
76,840 KB
testcase_11 AC 84 ms
76,916 KB
testcase_12 AC 85 ms
76,944 KB
testcase_13 AC 82 ms
76,488 KB
testcase_14 AC 84 ms
76,560 KB
testcase_15 AC 85 ms
76,928 KB
testcase_16 AC 84 ms
76,932 KB
testcase_17 AC 84 ms
76,940 KB
testcase_18 AC 84 ms
76,960 KB
testcase_19 AC 85 ms
77,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
c, v = map(int, input().split())
dp = [1 << 30] * (n + 1)
dp[1] = 0
for i in range(1, n + 1):
    cost = c + dp[i]
    for j in range(2 * i, n + 1, i):
        cost += v
        dp[j] = min(dp[j], cost)
    dp[-1] = min(dp[-1], cost + v)
print(dp[-1])
0