結果
| 問題 |
No.555 世界史のレポート
|
| ユーザー |
treeone
|
| 提出日時 | 2017-08-12 00:54:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 673 bytes |
| コンパイル時間 | 1,226 ms |
| コンパイル使用メモリ | 158,080 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 22:40:09 |
| 合計ジャッジ時間 | 1,976 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;
const int INF = 1e12;
int dp[100010];
signed main(){
int n, c, v;
cin >> n >> c >> v;
rep(i, 0, 100010) dp[i] = INF;
dp[1] = 0;
rep(i, 1, 2 * n + 5){
for(int j = 2 * i; j <= 2 * n + 5; j += i){
dp[j] = min(dp[j], dp[i] + c + ((j / i) - 1) * v);
}
}
// rep(i, 1, n + 1){
// cout << i << " " << dp[i] << endl;
// }
int ans = INF;
rep(i, n, 2 * n + 5) ans = min(ans, dp[i]);
cout << ans << endl;
}
treeone