結果

問題 No.135 とりあえず1次元の問題
ユーザー kohaku_kohaku
提出日時 2016-11-12 07:48:45
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 2,382 ms
コンパイル使用メモリ 74,336 KB
実行使用メモリ 48,744 KB
最終ジャッジ日時 2024-06-11 07:06:28
合計ジャッジ時間 9,979 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] X = new int [N];
        for(int i=0; i<N; i++){
            X[i] = sc.nextInt();
        }
        Arrays.sort(X);
        int min = X[N-1];
        for(int i=1; i<N; i++){
            int temp = X[i]-X[i-1];
            if(temp!=0 && min>temp){
                min = temp;
            }
        }
        if( min!=X[N-1] ){
            System.out.println(min);
        }else{
            System.out.println(0);
        }
    }
}
0