結果

問題 No.851 テストケース
ユーザー tenten
提出日時 2021-02-09 08:08:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 3,153 ms
コード長 743 bytes
コンパイル時間 2,384 ms
コンパイル使用メモリ 75,756 KB
実行使用メモリ 54,416 KB
最終ジャッジ日時 2024-07-06 13:38:34
合計ジャッジ時間 6,157 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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