結果

問題 No.851 テストケース
ユーザー shigeki_createshigeki_create
提出日時 2019-08-15 03:31:16
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 778 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 80,100 KB
実行使用メモリ 57,616 KB
最終ジャッジ日時 2023-10-19 18:28:06
合計ジャッジ時間 6,154 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,292 KB
testcase_01 AC 128 ms
57,564 KB
testcase_02 AC 125 ms
57,252 KB
testcase_03 AC 126 ms
57,512 KB
testcase_04 AC 126 ms
57,340 KB
testcase_05 AC 131 ms
57,112 KB
testcase_06 AC 128 ms
57,400 KB
testcase_07 AC 125 ms
57,404 KB
testcase_08 AC 126 ms
57,432 KB
testcase_09 AC 126 ms
57,484 KB
testcase_10 AC 126 ms
57,536 KB
testcase_11 AC 127 ms
57,432 KB
testcase_12 AC 129 ms
55,444 KB
testcase_13 AC 128 ms
57,388 KB
testcase_14 AC 128 ms
57,396 KB
testcase_15 AC 131 ms
57,316 KB
testcase_16 AC 129 ms
57,480 KB
testcase_17 AC 130 ms
57,264 KB
testcase_18 AC 129 ms
57,540 KB
testcase_19 AC 127 ms
57,460 KB
testcase_20 AC 128 ms
57,356 KB
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

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