結果

問題 No.135 とりあえず1次元の問題
ユーザー mits58
提出日時 2016-05-05 15:08:14
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 1,842 ms
コンパイル使用メモリ 74,204 KB
実行使用メモリ 48,860 KB
最終ジャッジ日時 2024-06-11 06:48:11
合計ジャッジ時間 8,129 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 11 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
        	int n=sc.nextInt();
        	int[] x=new int[n];
        	for(int i=0;i<n;i++) x[i]=sc.nextInt();
        	Arrays.sort(x);
        	int res=Integer.MAX_VALUE/2;
        	for(int i=1;i<n;i++) res=Math.min(res, x[i]-x[i-1]);
        	System.out.println(res);
        }
    }
}
0