結果

問題 No.268 ラッピング(Easy)
ユーザー hanorverhanorver
提出日時 2015-08-21 23:04:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 685 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 66,904 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 15:18:01
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>

int main() {
	std::vector<int> length;
	std::vector<int> time;

	for (int i = 0; i < 3; i++) {
		int num;
		std::cin >> num;
		length.push_back(num);
	}

	for (int i = 0; i < 3; i++) {
		int num;
		std::cin >> num;
		time.push_back(num);
	}

	std::sort(length.begin(), length.end());
	int min = INT_MAX;
	do {
		int r = (length[0] * 2 + length[1] * 2) * time[0];
		int b = (length[2] * 2 + length[1] * 2) * time[1];
		int y = (length[0] * 2 + length[2] * 2) * time[2];
		min = std::min(min, r + b + y);
	}while(std::next_permutation(length.begin(), length.end()));

	std::cout << min << std::endl;
	return 0;
}
0