結果

問題 No.268 ラッピング(Easy)
ユーザー kusagame12
提出日時 2024-06-11 17:06:37
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 682 bytes
コンパイル時間 2,282 ms
コンパイル使用メモリ 74,420 KB
実行使用メモリ 41,728 KB
最終ジャッジ日時 2024-06-11 17:06:44
合計ジャッジ時間 4,803 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] ls = new int[3];
        for (int i=0; i<3; i++) {
            ls[i] = sc.nextInt();
        }

        int[] rollCnts = new int[3];
        for (int i=0; i<3; i++) {
            rollCnts[i] = sc.nextInt();
        }

        Arrays.sort(ls); // 昇順
        Arrays.sort(rollCnts);

        int ans = 0;

        ans += rollCnts[2] * ((ls[0] + ls[1]) * 2);
        ans += rollCnts[1] * ((ls[0] + ls[2]) * 2);
        ans += rollCnts[0] * ((ls[1] + ls[2]) * 2);

        System.out.println(ans);
    }

}
0