結果
問題 | No.555 世界史のレポート |
ユーザー | fine |
提出日時 | 2017-08-11 22:36:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 1,548 ms |
コンパイル使用メモリ | 166,360 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 21:18:56 |
合計ジャッジ時間 | 2,087 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int dp[50005]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, c, v; cin >> n >> c >> v; for (int i = 2; i <= n; i++) { dp[i] = INF; } for (int i = 1; i < n; i++) { for (int j = 1; j < (n + i - 1) / i; j++) { dp[min(i * (j + 1), n)] = min(dp[min(i * (j + 1), n)], dp[i] + c + v * j); } } cout << dp[n] << endl; return 0; }