結果

問題 No.135 とりあえず1次元の問題
ユーザー mits58mits58
提出日時 2016-05-05 15:12:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 71,624 KB
実行使用メモリ 62,828 KB
最終ジャッジ日時 2023-09-02 00:24:43
合計ジャッジ時間 9,289 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 608 ms
62,828 KB
testcase_01 AC 125 ms
55,900 KB
testcase_02 AC 124 ms
55,772 KB
testcase_03 WA -
testcase_04 AC 137 ms
55,968 KB
testcase_05 AC 138 ms
56,128 KB
testcase_06 AC 136 ms
58,092 KB
testcase_07 AC 135 ms
55,912 KB
testcase_08 AC 135 ms
56,180 KB
testcase_09 AC 138 ms
55,788 KB
testcase_10 AC 135 ms
55,612 KB
testcase_11 AC 136 ms
56,112 KB
testcase_12 AC 160 ms
55,936 KB
testcase_13 AC 136 ms
55,960 KB
testcase_14 AC 193 ms
56,084 KB
testcase_15 AC 155 ms
55,984 KB
testcase_16 AC 189 ms
56,176 KB
testcase_17 AC 181 ms
56,456 KB
testcase_18 AC 141 ms
56,364 KB
testcase_19 AC 179 ms
56,032 KB
testcase_20 AC 187 ms
56,076 KB
testcase_21 AC 565 ms
60,572 KB
testcase_22 AC 598 ms
60,852 KB
evil01.txt AC 577 ms
64,112 KB
権限があれば一括ダウンロードができます

ソースコード

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++){
        		if(x[i]==x[i-1]) continue;
        		res=Math.min(res, x[i]-x[i-1]);
        	}
        	System.out.println(res);
        }
    }
}
0