結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 696 ms
68,648 KB
testcase_01 AC 124 ms
56,040 KB
testcase_02 AC 123 ms
55,880 KB
testcase_03 WA -
testcase_04 AC 133 ms
56,172 KB
testcase_05 AC 132 ms
55,748 KB
testcase_06 AC 131 ms
56,000 KB
testcase_07 AC 134 ms
55,740 KB
testcase_08 AC 134 ms
58,124 KB
testcase_09 AC 133 ms
55,980 KB
testcase_10 AC 134 ms
56,040 KB
testcase_11 AC 136 ms
55,980 KB
testcase_12 AC 153 ms
56,280 KB
testcase_13 AC 136 ms
55,968 KB
testcase_14 AC 188 ms
56,052 KB
testcase_15 AC 160 ms
56,668 KB
testcase_16 AC 190 ms
56,680 KB
testcase_17 AC 184 ms
56,020 KB
testcase_18 AC 138 ms
55,740 KB
testcase_19 AC 185 ms
55,968 KB
testcase_20 AC 176 ms
56,528 KB
testcase_21 AC 565 ms
62,976 KB
testcase_22 AC 711 ms
66,876 KB
evil01.txt AC 660 ms
63,268 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++) {
			if (x[i+1] - x[i] > 0) {
				ans = Math.min(ans, x[i+1] - x[i]);
			}
		}
		System.out.println(ans);
	}

}
0