結果

問題 No.555 世界史のレポート
ユーザー Jumbo_kprJumbo_kpr
提出日時 2019-08-02 13:29:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,695 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 95,244 KB
実行使用メモリ 5,224 KB
最終ジャッジ日時 2023-09-18 18:11:37
合計ジャッジ時間 2,651 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,892 KB
testcase_01 AC 3 ms
4,956 KB
testcase_02 AC 3 ms
4,972 KB
testcase_03 AC 2 ms
5,024 KB
testcase_04 AC 3 ms
5,104 KB
testcase_05 AC 3 ms
5,104 KB
testcase_06 AC 3 ms
4,952 KB
testcase_07 AC 3 ms
5,052 KB
testcase_08 AC 3 ms
4,972 KB
testcase_09 AC 3 ms
4,956 KB
testcase_10 AC 15 ms
5,072 KB
testcase_11 AC 15 ms
5,000 KB
testcase_12 AC 14 ms
4,892 KB
testcase_13 AC 12 ms
4,996 KB
testcase_14 AC 15 ms
4,940 KB
testcase_15 AC 15 ms
5,180 KB
testcase_16 AC 13 ms
4,884 KB
testcase_17 AC 15 ms
5,224 KB
testcase_18 AC 14 ms
4,892 KB
testcase_19 AC 20 ms
5,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define double long double

using namespace std;

int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

int N, C, V;
int dp[200020];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> C >> V;
	REP(i, 200000)dp[i] = INF;
	dp[1] =0;
	dp[2] = C + V;
	FOR(i, 2, 3*N+1) {
		dp[i + 1] = dp[i] + V;
	}
	FOR(i, 2, N) {
		for (int j = i * 2; j < 3 * N; j += i) {
			dp[j] =min(dp[j], dp[i] + C + V * ((j / i)-1));
		}
	}

	int ans = INF;
	FOR(i, N, 2 * N) {
		ans = min(ans, dp[i]);
	}
	print(ans);
	//REP(i, N + 1) {
	//	pe(i)print(dp[i]);
	//}
}
0