結果
問題 | No.268 ラッピング(Easy) |
ユーザー |
![]() |
提出日時 | 2015-08-21 22:45:05 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 126 ms / 5,000 ms |
コード長 | 823 bytes |
コンパイル時間 | 2,100 ms |
コンパイル使用メモリ | 77,800 KB |
実行使用メモリ | 41,652 KB |
最終ジャッジ日時 | 2024-07-18 11:47:01 |
合計ジャッジ時間 | 4,023 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
import java.util.*; import java.io.*; import java.math.*; public class Main { static int R; static int B; static int Y; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] l = new int[3]; l[0] = sc.nextInt(); l[1] = sc.nextInt(); l[2] = sc.nextInt(); R = sc.nextInt(); B = sc.nextInt(); Y = sc.nextInt(); int min = check(l,new boolean[3],new int[3],0); System.out.println(min); } static int check(int[] a, boolean[] b, int[] c, int d) { if(d == 3) { return c[0] * 2 * R + c[2] * 2 * R + c[0] * 2 * B + c[1] * 2 * B + c[1] *2 * Y + c[2] * 2 * Y; } int min = Integer.MAX_VALUE; for(int i = 0; i < 3; i++) { if(b[i]) continue; b[i] = true; c[d] = a[i]; min = Math.min(check(a,b,c,d+1), min); b[i] = false; c[d] = 0; } return min; } }