結果

問題 No.135 とりあえず1次元の問題
ユーザー キョウチク
提出日時 2019-09-20 03:47:32
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 3,361 ms
コンパイル使用メモリ 75,972 KB
実行使用メモリ 61,184 KB
最終ジャッジ日時 2024-09-13 11:20:36
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 11 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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) {
        		min=Math.abs(X[i-1]-X[i]);
        	}
        }
        System.out.println(min);
    }
}
0