結果
| 問題 |
No.851 テストケース
|
| コンテスト | |
| ユーザー |
shigeki_create
|
| 提出日時 | 2019-08-15 03:22:37 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 767 bytes |
| コンパイル時間 | 2,228 ms |
| コンパイル使用メモリ | 79,216 KB |
| 実行使用メモリ | 56,164 KB |
| 最終ジャッジ日時 | 2024-09-19 14:47:05 |
| 合計ジャッジ時間 | 5,874 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 18 |
ソースコード
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.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; 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(2));
}
public static void print(Object o) {
System.out.print(o);
}
public static void println(Object o) {
System.out.println(o);
}
}
shigeki_create