結果

問題 No.135 とりあえず1次元の問題
ユーザー YatsukuYatsuku
提出日時 2015-12-11 23:46:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 74,272 KB
実行使用メモリ 59,692 KB
最終ジャッジ日時 2024-06-11 04:57:08
合計ジャッジ時間 8,150 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 613 ms
59,692 KB
testcase_01 AC 107 ms
52,936 KB
testcase_02 AC 106 ms
52,632 KB
testcase_03 AC 105 ms
52,688 KB
testcase_04 WA -
testcase_05 AC 126 ms
53,660 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 178 ms
54,108 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 614 ms
59,096 KB
evil01.txt AC 535 ms
59,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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();
		}

		int min = 100000;
		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 == 100000 ) {
			System.out.println(0);
		} else {
			System.out.println(min);
		}

	}
}
0