結果

問題 No.555 世界史のレポート
ユーザー fiordfiord
提出日時 2017-08-15 17:05:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 63,360 KB
最終ジャッジ日時 2024-04-21 12:30:54
合計ジャッジ時間 1,857 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,712 KB
testcase_01 AC 38 ms
51,584 KB
testcase_02 AC 38 ms
51,840 KB
testcase_03 AC 44 ms
58,880 KB
testcase_04 AC 44 ms
59,136 KB
testcase_05 AC 46 ms
59,648 KB
testcase_06 AC 51 ms
60,160 KB
testcase_07 AC 46 ms
60,160 KB
testcase_08 AC 47 ms
59,904 KB
testcase_09 AC 47 ms
60,032 KB
testcase_10 AC 56 ms
62,720 KB
testcase_11 AC 54 ms
62,976 KB
testcase_12 AC 56 ms
62,976 KB
testcase_13 AC 58 ms
62,848 KB
testcase_14 AC 61 ms
63,360 KB
testcase_15 AC 56 ms
62,976 KB
testcase_16 AC 54 ms
62,976 KB
testcase_17 AC 58 ms
62,592 KB
testcase_18 AC 55 ms
62,976 KB
testcase_19 AC 56 ms
63,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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