結果
問題 | No.268 ラッピング(Easy) |
ユーザー |
![]() |
提出日時 | 2020-11-18 09:05:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 134 ms / 5,000 ms |
コード長 | 924 bytes |
コンパイル時間 | 2,097 ms |
コンパイル使用メモリ | 77,376 KB |
実行使用メモリ | 54,296 KB |
最終ジャッジ日時 | 2024-07-23 08:51:26 |
合計ジャッジ時間 | 4,591 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int[] base = new int[3];for (int i = 0; i < 3; i++) {base[i] = sc.nextInt();}int[] lengths = new int[3];for (int i = 0; i < 3; i++) {lengths[i] = base[i] + base[(i + 1) % 3];lengths[i] *= 2;}int[] rgb = new int[3];for (int i = 0; i < 3; i++) {rgb[i] = sc.nextInt();}int[][] perm = new int[][]{{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[] order : perm) {int sum = 0;for (int i = 0; i < 3; i++) {sum += lengths[i] * rgb[order[i]];}min = Math.min(min, sum);}System.out.println(min);}}