結果

問題 No.135 とりあえず1次元の問題
ユーザー rf141rf141
提出日時 2015-08-10 03:17:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 3,186 ms
コンパイル使用メモリ 72,804 KB
実行使用メモリ 60,736 KB
最終ジャッジ日時 2023-09-01 21:22:01
合計ジャッジ時間 10,603 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 121 ms
55,776 KB
testcase_02 AC 121 ms
55,472 KB
testcase_03 AC 122 ms
56,084 KB
testcase_04 WA -
testcase_05 AC 132 ms
55,756 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 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 526 ms
60,392 KB
evil01.txt AC 526 ms
61,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class liner{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if(n==1){
			System.out.println(0);
			return;
		}
		int[] point = new int[n];
		for(int i = 0; i < n; i++){
			point[i] = scan.nextInt();
		}
		System.out.println(result(point,n));
	}
	public static int result(int[] point,int n){
		int min = point[1]-point[0];
		if(n==2)return min;
		for(int i = 1; i < n-1; i++){
			if(point[i+1]-point[i] < min && point[i+1]-point[i] > 0){
				min = point[i+1]-point[i];
			}
		}
		return min;
	}
}
0