結果
問題 | No.555 世界史のレポート |
ユーザー |
|
提出日時 | 2021-10-10 03:43:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 2,441 ms |
コンパイル使用メモリ | 191,460 KB |
最終ジャッジ日時 | 2025-01-25 00:00:11 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;long long int dp[50005];int main(void){cin.tie(0);ios::sync_with_stdio(false);int n,c,v;cin >> n;cin >> c >> v;fill(dp,dp+50005,1e18);dp[1] = 0;for(int i=1;i<=n;i++){long long int cost = c;for(int j=2*i; ;j+=i){cost += v;if(j >= n){dp[n] = min(dp[n],dp[i] + cost);break;}else{dp[j] = min(dp[j],dp[i] + cost);}}}cout << dp[n] << '\n';return 0;}