結果

問題 No.135 とりあえず1次元の問題
ユーザー カニ戯(ryカニ戯(ry
提出日時 2015-02-24 16:23:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 369 bytes
コンパイル時間 2,337 ms
コンパイル使用メモリ 71,764 KB
実行使用メモリ 60,796 KB
最終ジャッジ日時 2023-09-01 02:56:56
合計ジャッジ時間 9,257 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 587 ms
60,772 KB
testcase_01 AC 122 ms
55,832 KB
testcase_02 AC 126 ms
55,964 KB
testcase_03 WA -
testcase_04 AC 131 ms
56,456 KB
testcase_05 AC 135 ms
55,908 KB
testcase_06 AC 134 ms
55,880 KB
testcase_07 AC 132 ms
55,624 KB
testcase_08 AC 137 ms
56,024 KB
testcase_09 AC 138 ms
56,076 KB
testcase_10 AC 136 ms
55,956 KB
testcase_11 AC 137 ms
56,176 KB
testcase_12 AC 161 ms
56,228 KB
testcase_13 AC 136 ms
56,388 KB
testcase_14 AC 189 ms
56,572 KB
testcase_15 AC 158 ms
56,084 KB
testcase_16 AC 192 ms
56,200 KB
testcase_17 AC 192 ms
56,388 KB
testcase_18 AC 160 ms
55,828 KB
testcase_19 AC 188 ms
56,080 KB
testcase_20 AC 182 ms
56,248 KB
testcase_21 AC 569 ms
60,528 KB
testcase_22 AC 601 ms
60,796 KB
evil01.txt AC 598 ms
61,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] a) {
		Scanner s = new Scanner(System.in);
		int N=s.nextInt(),i=0,d,m=Integer.MAX_VALUE;
		int[] X=new int[N];
		for(;i<N;)X[i++]=s.nextInt();
		Arrays.sort(X);
		for(i=0;i<N-1;){
			d=Math.abs(X[i]-X[++i]);
			m=(d>0&&d<m)?d:m;
		}
		System.out.println(m);
	}
}
0