結果

問題 No.555 世界史のレポート
ユーザー autumn-eelautumn-eel
提出日時 2017-08-12 08:23:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 1,610 ms
コンパイル使用メモリ 162,284 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2024-04-21 05:52:05
合計ジャッジ時間 3,119 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
7,552 KB
testcase_01 AC 53 ms
7,552 KB
testcase_02 AC 51 ms
7,808 KB
testcase_03 AC 52 ms
7,680 KB
testcase_04 AC 52 ms
7,680 KB
testcase_05 AC 52 ms
7,680 KB
testcase_06 AC 49 ms
7,552 KB
testcase_07 AC 51 ms
7,552 KB
testcase_08 AC 51 ms
7,680 KB
testcase_09 AC 50 ms
7,680 KB
testcase_10 AC 53 ms
7,680 KB
testcase_11 AC 50 ms
7,552 KB
testcase_12 AC 50 ms
7,680 KB
testcase_13 AC 52 ms
7,808 KB
testcase_14 AC 51 ms
7,552 KB
testcase_15 AC 52 ms
7,680 KB
testcase_16 AC 53 ms
7,808 KB
testcase_17 AC 51 ms
7,808 KB
testcase_18 AC 51 ms
7,680 KB
testcase_19 AC 52 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int dp[1000000];
int main() {
	int n,c,v;scanf("%d%d%d",&n,&c,&v);
	memset(dp,0x3f,sizeof(dp));
	dp[1]=0;
	for(int i=1;i<1000000;i++){
		for(int j=i*2;j<1000000;j+=i)dp[j]=min(dp[j],dp[i]+c+(j/i-1)*v);
	}
	int Min=INF;
	for(int i=n;i<1000000;i++){
		Min=min(Min,dp[i]);
	}
	printf("%d\n",Min);
}
0