結果

問題 No.135 とりあえず1次元の問題
ユーザー ぴろずぴろず
提出日時 2015-01-25 23:23:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 2,116 ms
コンパイル使用メモリ 72,628 KB
実行使用メモリ 67,416 KB
最終ジャッジ日時 2023-08-31 01:21:28
合計ジャッジ時間 9,571 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 711 ms
67,252 KB
testcase_01 AC 125 ms
56,028 KB
testcase_02 WA -
testcase_03 AC 126 ms
56,188 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 154 ms
56,224 KB
testcase_13 AC 138 ms
55,540 KB
testcase_14 AC 189 ms
56,400 KB
testcase_15 AC 157 ms
55,756 KB
testcase_16 WA -
testcase_17 AC 185 ms
56,148 KB
testcase_18 AC 140 ms
56,076 KB
testcase_19 AC 188 ms
56,396 KB
testcase_20 AC 183 ms
56,712 KB
testcase_21 WA -
testcase_22 WA -
evil01.txt AC 654 ms
63,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no135;

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (n == 0) {
			System.out.println(0);
			return;
		}
		Integer[] x = new Integer[n];
		for(int i=0;i<n;i++) {
			x[i] = sc.nextInt();
		}
		Arrays.sort(x);
		int ans = 1 << 29;
		for(int i=0;i<n-1;i++) {
			ans = Math.min(ans, x[i+1] - x[i]);
		}
		System.out.println(ans);
	}

}
0