結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
fkwnw3_1243
|
| 提出日時 | 2017-04-29 17:13:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 980 bytes |
| コンパイル時間 | 2,197 ms |
| コンパイル使用メモリ | 74,812 KB |
| 実行使用メモリ | 67,252 KB |
| 最終ジャッジ日時 | 2024-09-13 22:55:09 |
| 合計ジャッジ時間 | 15,170 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 21 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.System.in;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
int N = Integer.parseInt(reader.readLine());
String[] inputs = reader.readLine().split(" ");
long minDistance = Long.MAX_VALUE;
boolean found = false;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
long x = Long.parseLong(inputs[i]);
long y = Long.parseLong(inputs[j]);
if(x != y) {
minDistance = Math.min(minDistance, Math.abs(x - y));
found = true;
}
}
}
if (found) {
System.out.println(minDistance);
} else {
System.out.println(0);
}
}
}
fkwnw3_1243