結果

問題 No.851 テストケース
ユーザー tentententen
提出日時 2021-02-09 08:08:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 3,153 ms
コード長 743 bytes
コンパイル時間 2,320 ms
コンパイル使用メモリ 72,768 KB
実行使用メモリ 56,396 KB
最終ジャッジ日時 2023-09-20 18:45:14
合計ジャッジ時間 5,874 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,044 KB
testcase_01 AC 121 ms
56,156 KB
testcase_02 AC 121 ms
55,636 KB
testcase_03 AC 122 ms
56,396 KB
testcase_04 AC 121 ms
55,428 KB
testcase_05 AC 122 ms
55,476 KB
testcase_06 AC 121 ms
56,064 KB
testcase_07 AC 122 ms
55,828 KB
testcase_08 AC 121 ms
56,056 KB
testcase_09 AC 121 ms
56,212 KB
testcase_10 AC 120 ms
56,136 KB
testcase_11 AC 121 ms
55,896 KB
testcase_12 AC 121 ms
56,144 KB
testcase_13 AC 120 ms
55,504 KB
testcase_14 AC 121 ms
55,476 KB
testcase_15 AC 120 ms
55,996 KB
testcase_16 AC 120 ms
55,864 KB
testcase_17 AC 125 ms
55,868 KB
testcase_18 AC 120 ms
55,628 KB
testcase_19 AC 123 ms
55,640 KB
testcase_20 AC 120 ms
55,372 KB
testcase_21 AC 121 ms
55,800 KB
testcase_22 AC 123 ms
55,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            Integer.parseInt(sc.nextLine());
            long[] arr = new long[3];
            for (int i = 0; i < 3; i++) {
                arr[i] = Long.parseLong(sc.nextLine());
            }
            TreeSet<Long> sums = new TreeSet<>();
            for (int i = 0; i < 2; i++) {
                for (int j = i + 1; j < 3; j++) {
                    sums.add(arr[i] + arr[j]);
                }
            }
            sums.pollLast();
            System.out.println(sums.last());
            
        } catch (Exception e) {
            System.out.println("\"assert\"");
        }
    }
}
0