結果

問題 No.268 ラッピング(Easy)
ユーザー htensaihtensai
提出日時 2019-12-17 16:01:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 953 bytes
コンパイル時間 3,356 ms
コンパイル使用メモリ 73,656 KB
実行使用メモリ 49,692 KB
最終ジャッジ日時 2023-09-15 19:39:19
合計ジャッジ時間 4,727 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,524 KB
testcase_01 AC 43 ms
49,460 KB
testcase_02 AC 44 ms
49,612 KB
testcase_03 AC 42 ms
49,368 KB
testcase_04 AC 43 ms
49,368 KB
testcase_05 AC 42 ms
49,464 KB
testcase_06 AC 43 ms
49,692 KB
testcase_07 AC 42 ms
49,392 KB
testcase_08 AC 42 ms
49,436 KB
testcase_09 AC 42 ms
49,408 KB
testcase_10 AC 41 ms
49,220 KB
testcase_11 AC 42 ms
49,388 KB
testcase_12 AC 41 ms
49,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] first = br.readLine().split(" ", 3);
        int[] lengths = new int[3];
        for (int i = 0; i < 3; i++) {
            lengths[i] = Integer.parseInt(first[i]);
        }
        int[] total = new int[3];
        total[0] = (lengths[0] + lengths[1]) * 2;
        total[1] = (lengths[1] + lengths[2]) * 2;
        total[2] = (lengths[2] + lengths[0]) * 2;
        Arrays.sort(total);
        String[] second = br.readLine().split(" ", 3);
        int[] colors = new int[3];
        for (int i = 0; i < 3; i++) {
            colors[i] = Integer.parseInt(second[i]);
        }
        Arrays.sort(colors);
        int ans = colors[0] * total[2] + colors[1] * total[1] + colors[2] * total[0];
        System.out.println(ans);
    }

}
0