結果

問題 No.716 距離
ユーザー ryunocchiryunocchi
提出日時 2019-03-22 02:44:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 2,258 ms
コンパイル使用メモリ 79,448 KB
実行使用メモリ 57,960 KB
最終ジャッジ日時 2023-10-19 05:54:55
合計ジャッジ時間 11,039 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
57,824 KB
testcase_01 AC 193 ms
57,604 KB
testcase_02 AC 194 ms
57,960 KB
testcase_03 AC 199 ms
57,668 KB
testcase_04 AC 194 ms
57,700 KB
testcase_05 AC 196 ms
57,836 KB
testcase_06 AC 188 ms
57,852 KB
testcase_07 AC 138 ms
57,500 KB
testcase_08 AC 133 ms
57,408 KB
testcase_09 AC 134 ms
57,400 KB
testcase_10 AC 189 ms
55,744 KB
testcase_11 AC 186 ms
57,656 KB
testcase_12 AC 200 ms
57,916 KB
testcase_13 AC 191 ms
57,684 KB
testcase_14 AC 135 ms
57,632 KB
testcase_15 AC 197 ms
56,028 KB
testcase_16 AC 187 ms
57,624 KB
testcase_17 AC 194 ms
57,640 KB
testcase_18 AC 146 ms
57,680 KB
testcase_19 AC 183 ms
57,652 KB
testcase_20 AC 138 ms
57,532 KB
testcase_21 AC 151 ms
57,200 KB
testcase_22 AC 155 ms
57,676 KB
testcase_23 AC 145 ms
57,556 KB
testcase_24 AC 195 ms
57,624 KB
testcase_25 AC 188 ms
57,676 KB
testcase_26 AC 191 ms
57,756 KB
testcase_27 AC 196 ms
57,836 KB
testcase_28 AC 145 ms
57,584 KB
testcase_29 AC 194 ms
57,684 KB
testcase_30 AC 193 ms
57,848 KB
testcase_31 AC 197 ms
57,796 KB
testcase_32 AC 195 ms
57,872 KB
testcase_33 AC 189 ms
57,696 KB
testcase_34 AC 194 ms
57,656 KB
testcase_35 AC 142 ms
57,536 KB
testcase_36 AC 156 ms
57,668 KB
testcase_37 AC 143 ms
57,656 KB
testcase_38 AC 175 ms
57,692 KB
testcase_39 AC 191 ms
57,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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