結果

問題 No.716 距離
ユーザー GodNegotoGodNegoto
提出日時 2019-11-20 16:48:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 3,766 ms
コンパイル使用メモリ 75,208 KB
実行使用メモリ 42,672 KB
最終ジャッジ日時 2024-04-16 07:18:58
合計ジャッジ時間 12,004 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
42,604 KB
testcase_01 AC 198 ms
42,496 KB
testcase_02 AC 188 ms
42,476 KB
testcase_03 AC 191 ms
42,580 KB
testcase_04 AC 184 ms
42,672 KB
testcase_05 AC 202 ms
42,640 KB
testcase_06 AC 198 ms
42,464 KB
testcase_07 AC 134 ms
41,512 KB
testcase_08 AC 137 ms
41,276 KB
testcase_09 AC 120 ms
40,288 KB
testcase_10 AC 194 ms
42,264 KB
testcase_11 AC 185 ms
41,748 KB
testcase_12 AC 193 ms
42,088 KB
testcase_13 AC 187 ms
42,292 KB
testcase_14 AC 132 ms
41,060 KB
testcase_15 AC 198 ms
42,156 KB
testcase_16 AC 190 ms
42,096 KB
testcase_17 AC 196 ms
42,480 KB
testcase_18 AC 146 ms
41,524 KB
testcase_19 AC 184 ms
41,684 KB
testcase_20 AC 136 ms
41,408 KB
testcase_21 AC 153 ms
41,668 KB
testcase_22 AC 172 ms
41,776 KB
testcase_23 AC 150 ms
41,600 KB
testcase_24 AC 195 ms
42,040 KB
testcase_25 AC 182 ms
41,684 KB
testcase_26 AC 192 ms
41,940 KB
testcase_27 AC 180 ms
42,120 KB
testcase_28 AC 146 ms
41,288 KB
testcase_29 AC 188 ms
42,412 KB
testcase_30 AC 189 ms
41,972 KB
testcase_31 AC 184 ms
42,072 KB
testcase_32 AC 191 ms
42,104 KB
testcase_33 AC 190 ms
41,972 KB
testcase_34 AC 188 ms
42,068 KB
testcase_35 AC 140 ms
41,156 KB
testcase_36 AC 159 ms
41,568 KB
testcase_37 AC 142 ms
41,188 KB
testcase_38 AC 178 ms
41,728 KB
testcase_39 AC 189 ms
42,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package algo;

import java.util.ArrayList;
import java.util.Scanner;

import java.util.*;

public class sample7 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		
		for(int i=0; i < N; i++) {
			list.add(sc.nextInt());
		}
		
		
		int min = Math.abs(list.get(0) - list.get(1));
		for(int i=1; i < N - 1; i++) {
			min = Math.min(min, Math.abs(list.get(i) - list.get(i+1)));
		}
		System.out.println(min);
		System.out.println(list.get(N - 1) - list.get(0));
	}
}
0