結果

問題 No.135 とりあえず1次元の問題
ユーザー ffmm00ffmm00
提出日時 2015-06-11 17:46:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 3,877 ms
コンパイル使用メモリ 71,732 KB
実行使用メモリ 60,488 KB
最終ジャッジ日時 2023-09-01 03:44:08
合計ジャッジ時間 11,512 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 574 ms
60,488 KB
testcase_01 AC 133 ms
56,504 KB
testcase_02 AC 125 ms
55,992 KB
testcase_03 AC 125 ms
55,944 KB
testcase_04 WA -
testcase_05 AC 141 ms
55,896 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 183 ms
56,308 KB
testcase_20 WA -
testcase_21 AC 563 ms
60,300 KB
testcase_22 AC 553 ms
60,220 KB
evil01.txt AC 557 ms
60,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N135 {

	public static void main(String[] args) {

		Scanner sca = new Scanner(System.in);

		int N = sca.nextInt();
		int[] x = new int[N];
		int A = 0;
		int min = 1000001;

		for (int i = 0; i < N; i++) {
			x[i] = sca.nextInt();
		}

		for (int i = 0; i < N - 1; i++) {
			if (x[i] != x[i + 1]) {
				A = Math.abs(x[i] - x[i + 1]);
				min = Math.min(A, min);
			}
		}

		if (min == 1000001)
			System.out.println(0);
		else
			System.out.println(min);

	}

}
0