結果

問題 No.268 ラッピング(Easy)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-14 21:22:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 3,974 ms
コンパイル使用メモリ 77,104 KB
実行使用メモリ 54,404 KB
最終ジャッジ日時 2024-04-17 19:40:08
合計ジャッジ時間 5,479 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
53,864 KB
testcase_01 AC 115 ms
53,888 KB
testcase_02 AC 122 ms
54,164 KB
testcase_03 AC 117 ms
54,356 KB
testcase_04 AC 119 ms
53,908 KB
testcase_05 AC 118 ms
54,088 KB
testcase_06 AC 124 ms
54,100 KB
testcase_07 AC 122 ms
54,164 KB
testcase_08 AC 106 ms
53,028 KB
testcase_09 AC 103 ms
52,804 KB
testcase_10 AC 108 ms
52,952 KB
testcase_11 AC 120 ms
54,092 KB
testcase_12 AC 122 ms
54,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise83{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);
    Integer[] box = new Integer[3];
    Integer[] ribbon = new Integer[3];
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    for(int i = 0; i < ribbon.length; i++){
      ribbon[i] = sc.nextInt();
    }
    box[0] = a + b;
    box[1] = a + c;
    box[2] = b + c;

    Arrays.sort(box, Comparator.naturalOrder());
    Arrays.sort(ribbon, Comparator.reverseOrder());
    
    int sum = 0;
    for(int i = 0; i < box.length; i++){
      sum += box[i] * 2 * ribbon[i];
    }

    System.out.println(sum);
  }
}
0