結果

問題 No.268 ラッピング(Easy)
ユーザー hanorver
提出日時 2015-08-21 23:04:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 685 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 65,808 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 12:04:44
合計ジャッジ時間 1,288 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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