結果

問題 No.135 とりあえず1次元の問題
ユーザー YatsukuYatsuku
提出日時 2015-12-12 00:29:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 2,260 ms
コンパイル使用メモリ 71,952 KB
実行使用メモリ 61,212 KB
最終ジャッジ日時 2023-09-01 22:56:16
合計ジャッジ時間 9,740 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 596 ms
60,620 KB
testcase_01 AC 128 ms
53,728 KB
testcase_02 AC 127 ms
55,984 KB
testcase_03 WA -
testcase_04 AC 137 ms
55,784 KB
testcase_05 AC 136 ms
55,828 KB
testcase_06 AC 136 ms
56,156 KB
testcase_07 AC 137 ms
55,804 KB
testcase_08 AC 138 ms
55,832 KB
testcase_09 AC 139 ms
55,956 KB
testcase_10 AC 141 ms
56,148 KB
testcase_11 AC 136 ms
56,412 KB
testcase_12 AC 155 ms
55,868 KB
testcase_13 AC 135 ms
55,568 KB
testcase_14 AC 187 ms
55,988 KB
testcase_15 AC 156 ms
56,152 KB
testcase_16 AC 190 ms
56,004 KB
testcase_17 AC 193 ms
56,708 KB
testcase_18 AC 144 ms
55,928 KB
testcase_19 AC 188 ms
56,040 KB
testcase_20 AC 188 ms
56,176 KB
testcase_21 WA -
testcase_22 AC 613 ms
60,508 KB
evil01.txt AC 593 ms
61,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class No_135 {
	public static void main(String args[]) {

		Scanner stdIn = new Scanner(System.in);		

		int num = stdIn.nextInt();

		int x_axis[] = new int[num];

		for (int i = 0; i < num; i++) {
			x_axis[i]	= stdIn.nextInt();
		}

		Arrays.sort(x_axis);

		int min = 10000000;
		int tmp;
		for (int j = 0; j <= num - 2; j++) {
			if ( x_axis[j] == x_axis[j+1]) { continue; }
			tmp = Math.abs(x_axis[j] - x_axis[j+1]);	
			if ( tmp <= min ) { min = tmp; }
		}

		if ( min == 1000000 ) {
			System.out.println(0);
		} else {
			System.out.println(min);
		}

	}
}
0