結果

問題 No.268 ラッピング(Easy)
ユーザー c_r_5c_r_5
提出日時 2018-10-26 15:52:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 4,044 ms
コンパイル使用メモリ 81,112 KB
実行使用メモリ 56,204 KB
最終ジャッジ日時 2023-08-12 07:22:56
合計ジャッジ時間 6,150 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,764 KB
testcase_01 AC 120 ms
55,936 KB
testcase_02 AC 119 ms
56,092 KB
testcase_03 AC 121 ms
55,944 KB
testcase_04 AC 121 ms
55,552 KB
testcase_05 AC 121 ms
55,632 KB
testcase_06 AC 120 ms
55,520 KB
testcase_07 AC 121 ms
55,872 KB
testcase_08 AC 122 ms
55,784 KB
testcase_09 AC 121 ms
56,204 KB
testcase_10 AC 122 ms
55,688 KB
testcase_11 AC 119 ms
55,536 KB
testcase_12 AC 119 ms
55,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] l = new int[3];
		for (int i = 0; i < 3; i++)
			l[i] = Integer.parseInt(sc.next());
		Integer[] r = new Integer[3];
		for (int i = 0; i < 3; i++)
			r[i] = Integer.parseInt(sc.next());
		Arrays.sort(l);
		Arrays.sort(r, Comparator.reverseOrder());
		int ans = r[0] * (l[0] + l[1]) * 2;
		if (l[1] + l[2] > l[2] + l[0]) {
			int t = r[1];
			r[1] = r[2];
			r[2] = t;
		}
		ans += r[1] * (l[1] + l[2]) * 2;
		ans += r[2] * (l[2] + l[0]) * 2;
		System.out.println(ans);
	}
}
0