結果

問題 No.268 ラッピング(Easy)
ユーザー YamaKasaYamaKasa
提出日時 2018-09-08 14:59:54
言語 Java19
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 681 bytes
コンパイル時間 3,133 ms
コンパイル使用メモリ 77,408 KB
実行使用メモリ 56,556 KB
最終ジャッジ日時 2023-08-22 09:38:49
合計ジャッジ時間 5,660 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,092 KB
testcase_01 AC 120 ms
56,068 KB
testcase_02 AC 119 ms
55,928 KB
testcase_03 AC 119 ms
56,556 KB
testcase_04 AC 121 ms
54,052 KB
testcase_05 AC 123 ms
55,772 KB
testcase_06 AC 122 ms
55,924 KB
testcase_07 AC 120 ms
55,716 KB
testcase_08 AC 123 ms
55,788 KB
testcase_09 AC 122 ms
55,808 KB
testcase_10 AC 123 ms
55,948 KB
testcase_11 AC 125 ms
56,200 KB
testcase_12 AC 124 ms
55,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int L1 = scan.nextInt();
		int L2 = scan.nextInt();
		int L3 = scan.nextInt();
		int R = scan.nextInt();
		int B = scan.nextInt();
		int Y = scan.nextInt();
		scan.close();
		int[]k = new int[3];
		k[0] = 2 * (L1 + L2);
		k[1] = 2 * (L1 + L3);
		k[2] = 2 * (L2 + L3);
		int[][] a = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0},
						{2, 0, 1}, {2, 1, 0}};
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < 6; i++) {
			int t = R * k[a[i][0]] + B * k[a[i][1]] + Y * k[a[i][2]];
			if(min > t) {
				min = t;
			}
		}
		System.out.println(min);
	}
}
0