結果

問題 No.555 世界史のレポート
ユーザー myantamyanta
提出日時 2017-08-12 01:01:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 37,760 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 00:24:49
合計ジャッジ時間 1,108 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include<queue>


using namespace std;
using vi=vector<int>;



int solve(int n, int c, int v)
{
	int cost_min=c+v*n;
	int cost;

	for(int copy_num=1;;copy_num++)
	{
		int copy_len=(1<<(copy_num-1));
		int paste_num=max((n-1-copy_len)/copy_len, 0);

		cost=copy_num*(c+v)+paste_num*v;
//		printf("copy_num=%d  paste_num=%d  cost=%d\n", copy_num, paste_num, cost);
		if(cost_min>cost) cost_min=cost;
		if(paste_num<=0) break;
	}
	return cost_min;
}


int main(void)
{
	int n, c, v;

	while(scanf("%d%d%d", &n, &c, &v)==3)
	{
		printf("%d\n", solve(n, c, v));
	}

	return 0;
}
0