結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
koukonko
|
| 提出日時 | 2015-12-12 15:06:51 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 633 bytes |
| 記録 | |
| コンパイル時間 | 2,365 ms |
| コンパイル使用メモリ | 83,608 KB |
| 実行使用メモリ | 71,612 KB |
| 最終ジャッジ日時 | 2026-06-06 14:58:13 |
| 合計ジャッジ時間 | 14,829 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 21 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int[] x = new int[N];
int ans = Integer.MAX_VALUE;
x[0] = scan.nextInt();
for (int i = 1; i < N; ++i) {
x[i] = scan.nextInt();
for (int j = i - 1; j > 0; --j) {
if (x[i] != x[j]) {
if (ans > Math.abs(x[i] - x[j])) {
ans = Math.abs(x[i] - x[j]);
}
}
}
}
if(ans == Integer.MAX_VALUE){
ans = 0;
}
System.out.println(ans);
scan.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
koukonko