結果
| 問題 |
No.555 世界史のレポート
|
| ユーザー |
|
| 提出日時 | 2017-08-18 04:31:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 855 bytes |
| コンパイル時間 | 1,415 ms |
| コンパイル使用メモリ | 167,984 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 14:16:18 |
| 合計ジャッジ時間 | 2,081 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
const ll INF = LLONG_MAX/3;
int main()
{
int n,c,v;
cin >>n >>c >>v;
vector<ll> dp(n+1,INF);
dp[1] = 0;
for(int i=1; i<n; ++i)
{
ll cost = c+v;
for(int j=2*i; j<=2*n; j+=i)
{
dp[min(n,j)] = min(dp[min(n,j)],dp[i]+cost);
cost += v;
}
}
cout << dp[n] << endl;
return 0;
}