結果
問題 |
No.555 世界史のレポート
|
ユーザー |
|
提出日時 | 2018-11-14 09:48:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 1,026 ms |
コンパイル使用メモリ | 63,872 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 13:35:10 |
合計ジャッジ時間 | 1,555 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
// coding on smartphone #include<iostream> using namespace std; const int INF = 1<<30; int main(){ int n, c, v; cin >> n >> c >> v; int dp[2*n]; for(int i = 0; i < 2*n; i++) dp[i] = INF; dp[1] = 0; for(int i = 1; i < 2*n; i++){ for(int j = i+i; j < 2*n; j += i){ dp[j] = min(dp[j], dp[i]+c+v*(j/i-1)); } } int ans = dp[n]; for(int i = n+1; i < 2*n; i++) ans = min(ans, dp[i]); cout << ans << endl; return 0; }