結果

問題 No.716 距離
ユーザー tentententen
提出日時 2020-12-09 09:08:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 3,951 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 57,980 KB
最終ジャッジ日時 2023-10-19 04:45:40
合計ジャッジ時間 11,741 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
57,732 KB
testcase_01 AC 201 ms
57,756 KB
testcase_02 AC 202 ms
57,708 KB
testcase_03 AC 202 ms
57,676 KB
testcase_04 AC 202 ms
57,668 KB
testcase_05 AC 202 ms
57,676 KB
testcase_06 AC 203 ms
57,624 KB
testcase_07 AC 139 ms
57,572 KB
testcase_08 AC 140 ms
55,320 KB
testcase_09 AC 142 ms
57,500 KB
testcase_10 AC 193 ms
57,704 KB
testcase_11 AC 189 ms
57,748 KB
testcase_12 AC 202 ms
57,816 KB
testcase_13 AC 200 ms
57,684 KB
testcase_14 AC 140 ms
57,456 KB
testcase_15 AC 199 ms
57,492 KB
testcase_16 AC 188 ms
57,724 KB
testcase_17 AC 193 ms
57,712 KB
testcase_18 AC 149 ms
57,712 KB
testcase_19 AC 189 ms
57,664 KB
testcase_20 AC 140 ms
57,412 KB
testcase_21 AC 154 ms
57,652 KB
testcase_22 AC 156 ms
57,680 KB
testcase_23 AC 148 ms
57,508 KB
testcase_24 AC 198 ms
57,688 KB
testcase_25 AC 187 ms
57,692 KB
testcase_26 AC 194 ms
57,632 KB
testcase_27 AC 192 ms
57,684 KB
testcase_28 AC 147 ms
57,492 KB
testcase_29 AC 193 ms
57,408 KB
testcase_30 AC 193 ms
57,664 KB
testcase_31 AC 197 ms
57,716 KB
testcase_32 AC 196 ms
57,696 KB
testcase_33 AC 198 ms
57,980 KB
testcase_34 AC 194 ms
57,756 KB
testcase_35 AC 142 ms
57,416 KB
testcase_36 AC 157 ms
57,632 KB
testcase_37 AC 143 ms
57,540 KB
testcase_38 AC 176 ms
57,488 KB
testcase_39 AC 194 ms
57,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int min = Integer.MAX_VALUE;
        int prev = sc.nextInt();
        int first = prev;
        for (int i = 1; i < n; i++) {
            int cur = sc.nextInt();
            min = Math.min(min, cur - prev);
            max = cur - first;
            prev = cur;
        }
        System.out.println(min);
        System.out.println(max);
    }
}
0