結果
| 問題 | No.555 世界史のレポート |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2017-08-13 23:55:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 1,136 bytes |
| コンパイル時間 | 556 ms |
| コンパイル使用メモリ | 83,964 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 09:23:43 |
| 合計ジャッジ時間 | 1,808 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 555.cc: No.555 世界史のレポート - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 50000;
const int MAX_N2 = MAX_N * 2;
const int INF = 1 << 30;
/* typedef */
/* global variables */
int dp[MAX_N2];
/* subroutines */
inline void setmin(int &a, int b) { if (a > b) a = b; }
/* main */
int main() {
int n, c, v;
cin >> n >> c >> v;
int n2 = n * 2;
dp[1] = 0;
for (int i = 2; i < n2; i++) {
int mind = INF;
for (int j0 = 1; j0 * j0 <= i; j0++)
if (i % j0 == 0) {
int j1 = i / j0;
setmin(mind, dp[j0] + c + (j1 - 1) * v);
if (j1 != j0 && j1 < i)
setmin(mind, dp[j1] + c + (j0 - 1) * v);
}
dp[i] = mind;
}
int mind = INF;
for (int i = n; i < n2; i++)
setmin(mind, dp[i]);
printf("%d\n", mind);
return 0;
}
tnakao0123