結果

問題 No.135 とりあえず1次元の問題
ユーザー spaciaspacia
提出日時 2015-12-23 14:09:58
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 3,182 ms
コンパイル使用メモリ 72,636 KB
実行使用メモリ 61,216 KB
最終ジャッジ日時 2023-09-01 22:59:42
合計ジャッジ時間 5,529 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
61,216 KB
testcase_01 AC 45 ms
49,444 KB
testcase_02 AC 45 ms
49,128 KB
testcase_03 WA -
testcase_04 AC 46 ms
49,144 KB
testcase_05 AC 46 ms
49,216 KB
testcase_06 AC 46 ms
49,496 KB
testcase_07 AC 47 ms
49,216 KB
testcase_08 AC 46 ms
49,060 KB
testcase_09 AC 46 ms
49,440 KB
testcase_10 AC 46 ms
49,440 KB
testcase_11 AC 46 ms
49,232 KB
testcase_12 AC 48 ms
49,224 KB
testcase_13 AC 47 ms
49,268 KB
testcase_14 AC 53 ms
49,312 KB
testcase_15 AC 49 ms
49,248 KB
testcase_16 AC 53 ms
49,260 KB
testcase_17 AC 53 ms
49,476 KB
testcase_18 AC 47 ms
49,216 KB
testcase_19 AC 52 ms
49,256 KB
testcase_20 AC 49 ms
49,340 KB
testcase_21 AC 217 ms
60,884 KB
testcase_22 AC 250 ms
61,016 KB
evil01.txt AC 242 ms
61,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main135 {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) nums[i] = Integer.parseInt(line[i]);
		
		int ans = Integer.MAX_VALUE;
		Arrays.sort(nums);
		for (int i = 1; i < n; i++) {
			int sub = nums[i] - nums[i - 1];
			if (sub != 0 && sub < ans) ans = sub;
		}
		
		out(ans);
		
	}
}
0