結果

問題 No.716 距離
ユーザー YukimotoPGYukimotoPG
提出日時 2019-02-13 10:37:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 72,820 KB
実行使用メモリ 56,788 KB
最終ジャッジ日時 2023-10-11 11:07:43
合計ジャッジ時間 10,201 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
55,840 KB
testcase_01 AC 186 ms
56,368 KB
testcase_02 AC 185 ms
56,472 KB
testcase_03 AC 177 ms
55,860 KB
testcase_04 AC 183 ms
56,420 KB
testcase_05 AC 186 ms
56,160 KB
testcase_06 AC 185 ms
56,240 KB
testcase_07 AC 122 ms
56,764 KB
testcase_08 AC 122 ms
56,308 KB
testcase_09 AC 122 ms
56,184 KB
testcase_10 AC 185 ms
56,420 KB
testcase_11 AC 154 ms
56,248 KB
testcase_12 AC 177 ms
56,672 KB
testcase_13 AC 174 ms
56,384 KB
testcase_14 AC 122 ms
56,240 KB
testcase_15 AC 186 ms
56,324 KB
testcase_16 AC 182 ms
56,012 KB
testcase_17 AC 184 ms
56,344 KB
testcase_18 AC 136 ms
56,380 KB
testcase_19 AC 177 ms
56,192 KB
testcase_20 AC 127 ms
55,880 KB
testcase_21 AC 137 ms
56,216 KB
testcase_22 AC 152 ms
56,220 KB
testcase_23 AC 133 ms
55,892 KB
testcase_24 AC 182 ms
55,964 KB
testcase_25 AC 180 ms
56,788 KB
testcase_26 AC 183 ms
56,400 KB
testcase_27 AC 184 ms
56,304 KB
testcase_28 AC 131 ms
55,964 KB
testcase_29 AC 168 ms
53,928 KB
testcase_30 AC 180 ms
56,252 KB
testcase_31 AC 186 ms
56,052 KB
testcase_32 AC 182 ms
55,848 KB
testcase_33 AC 186 ms
56,536 KB
testcase_34 AC 176 ms
56,464 KB
testcase_35 AC 128 ms
56,028 KB
testcase_36 AC 143 ms
56,212 KB
testcase_37 AC 129 ms
56,176 KB
testcase_38 AC 168 ms
55,628 KB
testcase_39 AC 181 ms
56,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		int[] ar = new int[n];
		int min = Integer.MAX_VALUE;
		for (int i=0; i<n; i++) {
			ar[i] = sc.nextInt();
			if (i > 0) {
				min = Math.min(min, Math.abs(ar[i]-ar[i-1]));
			}
		}
		Arrays.sort(ar);
		System.out.println(min);
		System.out.println(ar[n-1]-ar[0]);
		
		
	}
}
0