結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-11-10 16:19:44 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 591 bytes |
| コンパイル時間 | 2,298 ms |
| コンパイル使用メモリ | 75,624 KB |
| 実行使用メモリ | 57,900 KB |
| 最終ジャッジ日時 | 2024-07-22 17:33:45 |
| 合計ジャッジ時間 | 10,711 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 1 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
TreeSet<Integer> set = new TreeSet<>();
for (int i = 0; i < n; i++) {
set.add(sc.nextInt());
}
if (set.size() == 0) {
System.out.println(0);
}
int prev = Integer.MIN_VALUE / 10;
int min = Integer.MAX_VALUE;
for (int x : set) {
min = Math.min(min, x - prev);
prev = x;
}
System.out.println(min);
}
}
tenten