結果

問題 No.268 ラッピング(Easy)
ユーザー data9824data9824
提出日時 2015-08-25 06:30:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 742 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 58,880 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 16:57:57
合計ジャッジ時間 1,210 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <limits>
#include <algorithm>

using namespace std;

int main() {
	int l[3];
	cin >> l[0] >> l[1] >> l[2];
	int r, b, y;
	cin >> r >> b >> y;
	int minLength = std::numeric_limits<int>::max();
	for (int heightIndex = 0; heightIndex < 3; ++heightIndex) {
		for (int widthIndex = 0; widthIndex < 3; ++widthIndex) {
			if (heightIndex == widthIndex) {
				continue;
			}
			int depthIndex = (3 - (heightIndex + widthIndex) % 3) % 3;
			int rLength = (l[heightIndex] + l[depthIndex]) * 2 * r;
			int bLength = (l[heightIndex] + l[widthIndex]) * 2 * b;
			int yLength = (l[widthIndex] + l[depthIndex]) * 2 * y;
			minLength = min(minLength, rLength + bLength + yLength);
		}
	}
	cout << minLength << endl;
	return 0;
}
0