結果

問題 No.21 平均の差
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-11 21:41:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 335 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 74,644 KB
実行使用メモリ 57,744 KB
最終ジャッジ日時 2023-10-24 21:23:20
合計ジャッジ時間 3,853 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
57,672 KB
testcase_01 AC 123 ms
57,572 KB
testcase_02 AC 124 ms
57,744 KB
testcase_03 AC 121 ms
57,564 KB
testcase_04 AC 120 ms
57,484 KB
testcase_05 AC 127 ms
57,256 KB
testcase_06 AC 116 ms
56,264 KB
testcase_07 AC 117 ms
55,756 KB
testcase_08 AC 123 ms
57,468 KB
testcase_09 AC 119 ms
57,480 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 K = sc.nextInt();
    int[] n = new int[N];
    for(int i = 0; i < N; i++) {
      n[i] = sc.nextInt();
    }
    Arrays.sort(n);
    System.out.println(n[N - 1] - n[0]);
  }
}
0