結果
| 問題 |
No.851 テストケース
|
| コンテスト | |
| ユーザー |
shigeki_create
|
| 提出日時 | 2019-08-15 03:21:00 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 763 bytes |
| コンパイル時間 | 3,461 ms |
| コンパイル使用メモリ | 79,692 KB |
| 実行使用メモリ | 56,168 KB |
| 最終ジャッジ日時 | 2024-09-19 14:46:59 |
| 合計ジャッジ時間 | 6,194 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | WA * 20 |
ソースコード
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