結果

問題 No.716 距離
ユーザー takeya_okinotakeya_okino
提出日時 2019-09-14 12:14:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 4,037 ms
コンパイル使用メモリ 71,072 KB
実行使用メモリ 56,552 KB
最終ジャッジ日時 2023-09-19 06:56:23
合計ジャッジ時間 14,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
55,944 KB
testcase_01 AC 196 ms
56,048 KB
testcase_02 AC 194 ms
56,068 KB
testcase_03 AC 191 ms
56,204 KB
testcase_04 AC 194 ms
56,552 KB
testcase_05 AC 192 ms
56,200 KB
testcase_06 AC 192 ms
56,356 KB
testcase_07 AC 127 ms
55,660 KB
testcase_08 AC 128 ms
55,880 KB
testcase_09 AC 129 ms
55,684 KB
testcase_10 AC 193 ms
55,952 KB
testcase_11 AC 173 ms
56,184 KB
testcase_12 AC 197 ms
55,900 KB
testcase_13 AC 191 ms
55,932 KB
testcase_14 AC 130 ms
55,460 KB
testcase_15 AC 195 ms
55,868 KB
testcase_16 AC 179 ms
55,916 KB
testcase_17 AC 197 ms
55,680 KB
testcase_18 AC 142 ms
55,620 KB
testcase_19 AC 185 ms
56,192 KB
testcase_20 AC 132 ms
55,396 KB
testcase_21 AC 147 ms
55,716 KB
testcase_22 AC 170 ms
55,832 KB
testcase_23 AC 140 ms
55,632 KB
testcase_24 AC 196 ms
56,020 KB
testcase_25 AC 174 ms
55,888 KB
testcase_26 AC 186 ms
55,672 KB
testcase_27 AC 196 ms
55,956 KB
testcase_28 AC 140 ms
55,452 KB
testcase_29 AC 190 ms
56,268 KB
testcase_30 AC 194 ms
55,916 KB
testcase_31 AC 195 ms
55,896 KB
testcase_32 AC 190 ms
56,148 KB
testcase_33 AC 193 ms
55,876 KB
testcase_34 AC 191 ms
56,064 KB
testcase_35 AC 137 ms
55,676 KB
testcase_36 AC 151 ms
56,224 KB
testcase_37 AC 136 ms
55,824 KB
testcase_38 AC 163 ms
55,892 KB
testcase_39 AC 192 ms
55,876 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[] a = new int[n];
    for(int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    int max = a[n - 1] - a[0];
    int min = (int)Math.pow(10, 6);
    for(int i = 0; i < n - 1; i++) {
      min = Math.min(min, a[i + 1] - a[i]);
    }
    System.out.println(min);
    System.out.println(max);
  }
}
0