結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2019-09-20 03:49:37 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 762 bytes |
コンパイル時間 | 3,662 ms |
コンパイル使用メモリ | 75,256 KB |
実行使用メモリ | 60,920 KB |
最終ジャッジ日時 | 2024-09-13 11:23:13 |
合計ジャッジ時間 | 7,021 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 1 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Test{ public static void main(String[] args) throws IOException{ BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(buf.readLine()); String[] s = buf.readLine().split(" "); int X[] = new int[N]; X[0]=Integer.parseInt(s[0]); for(int i=1;i<N;i++) { X[i]=Integer.parseInt(s[i]); } Arrays.sort(X); int min=1000000; for(int i=1;i<N;i++) { if(Math.abs(X[i-1]-X[i])<min && X[i-1]!=X[i]) { min=Math.abs(X[i-1]-X[i]); } } System.out.println(min); } }