結果

問題 No.135 とりあえず1次元の問題
ユーザー YatsukuYatsuku
提出日時 2015-12-11 19:51:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 4,401 ms
コンパイル使用メモリ 71,864 KB
実行使用メモリ 60,960 KB
最終ジャッジ日時 2023-09-01 22:50:57
合計ジャッジ時間 11,472 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 550 ms
60,616 KB
testcase_01 AC 127 ms
55,696 KB
testcase_02 AC 126 ms
55,756 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 137 ms
56,028 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 187 ms
55,764 KB
testcase_20 WA -
testcase_21 AC 566 ms
60,960 KB
testcase_22 AC 561 ms
60,412 KB
evil01.txt AC 541 ms
60,656 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 vc[] = new int[num];

		for (int i = 0; i < num; i++) {
			vc[i] = stdIn.nextInt();
		}
		System.out.println(vc_Length(vc, num));
	}

	public static int vc_Length(int vc[], int num) {

		int tmp = 1000000;
		for (int k = 0; k < num - 1; k++) {
			if (tmp >= Math.abs(vc[k] - vc[k+1])) {
				if ( vc[k] == vc[k+1] ) {
					continue;
				}
				tmp = Math.abs(vc[k] - vc[k+1]); 
			}
		}
		return tmp;
	}
}
0