結果

問題 No.851 テストケース
ユーザー shigeki_create
提出日時 2019-08-15 03:31:16
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 778 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 79,764 KB
実行使用メモリ 54,312 KB
最終ジャッジ日時 2024-09-19 14:47:11
合計ジャッジ時間 5,487 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

		int N = Integer.parseInt(sc.nextLine());

		int[] A = new int[N];

		for(int i=0; i<N; i++) {
			String str = sc.nextLine();
			if(str.split(" ").length > 1) {
				println("\"assert\"");
				return;
			}
			A[i] = Integer.parseInt(str);
		}

		List<Integer> sum = new ArrayList<>();

		for(int i=0; i<N; i++) {
			for(int j=i+1; j<N; j++) {
				int result = A[i] + A[j];
				if(!sum.contains(result)) sum.add(result);
			}
		}

		Collections.sort(sum, Comparator.reverseOrder());

		System.out.println(sum.get(1));
	}

	public static void print(Object o) {
		System.out.print(o);
	}

	public static void println(Object o) {
		System.out.println(o);
	}
}
0