結果

問題 No.268 ラッピング(Easy)
ユーザー YamaKasa
提出日時 2018-09-08 14:59:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 681 bytes
コンパイル時間 2,342 ms
コンパイル使用メモリ 77,436 KB
実行使用メモリ 41,364 KB
最終ジャッジ日時 2024-12-16 05:26:30
合計ジャッジ時間 4,317 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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