結果

問題 No.135 とりあえず1次元の問題
ユーザー fal_rndfal_rnd
提出日時 2016-11-29 00:40:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 631 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 4,325 ms
コンパイル使用メモリ 73,860 KB
実行使用メモリ 68,232 KB
最終ジャッジ日時 2023-09-02 00:46:31
合計ジャッジ時間 10,955 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 600 ms
68,232 KB
testcase_01 AC 115 ms
55,776 KB
testcase_02 AC 117 ms
56,140 KB
testcase_03 AC 117 ms
55,700 KB
testcase_04 AC 124 ms
56,152 KB
testcase_05 AC 124 ms
55,736 KB
testcase_06 AC 125 ms
55,700 KB
testcase_07 AC 125 ms
56,116 KB
testcase_08 AC 128 ms
55,884 KB
testcase_09 AC 127 ms
56,056 KB
testcase_10 AC 127 ms
55,892 KB
testcase_11 AC 126 ms
56,032 KB
testcase_12 AC 142 ms
55,540 KB
testcase_13 AC 126 ms
55,944 KB
testcase_14 AC 172 ms
57,268 KB
testcase_15 AC 142 ms
56,648 KB
testcase_16 AC 175 ms
57,308 KB
testcase_17 AC 172 ms
57,136 KB
testcase_18 AC 129 ms
55,816 KB
testcase_19 AC 174 ms
57,040 KB
testcase_20 AC 175 ms
55,052 KB
testcase_21 AC 519 ms
61,952 KB
testcase_22 AC 631 ms
66,536 KB
evil01.txt AC 605 ms
65,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class B{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		TreeSet<Integer> b = new TreeSet<Integer>();
		for(int i=Integer.parseInt(s.next());i>0;--i) {
			b.add(Integer.parseInt(s.next()));
		}
		Integer[] in = b.toArray(new Integer[0]);

		int r=Integer.MAX_VALUE;
		for(int i=0;i<in.length-1;++i) {
			r=Math.min(r, Math.abs(in[i]-in[i+1]));
		}
		System.out.println((r==Integer.MAX_VALUE)?0:r);
	}
}
0