結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-24 19:06:02 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 749 bytes |
| コンパイル時間 | 2,392 ms |
| コンパイル使用メモリ | 77,032 KB |
| 実行使用メモリ | 77,464 KB |
| 最終ジャッジ日時 | 2024-09-13 12:05:56 |
| 合計ジャッジ時間 | 15,003 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 21 |
ソースコード
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
List<Integer> p = new ArrayList<>();
for (int i = 0; i < N; i++) {
p.add(Integer.parseInt(sc.next()));
}
int d = Integer.MAX_VALUE;
for(int i = 0; i < N - 1; i++) {
for (int j = i + 1; j < N; j++) {
if (Math.abs(p.get(i) - p.get(j)) == 0) continue;
if (d > Math.abs(p.get(i) - p.get(j))) d = Math.abs(p.get(i) - p.get(j));
}
}
System.out.println((d == Integer.MAX_VALUE)? "0" : d);
}
}