結果

問題 No.21 平均の差
ユーザー tentententen
提出日時 2020-11-10 09:54:15
言語 Java19
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 388 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 71,936 KB
実行使用メモリ 56,236 KB
最終ジャッジ日時 2023-09-29 23:17:45
合計ジャッジ時間 4,141 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,984 KB
testcase_01 AC 128 ms
55,696 KB
testcase_02 AC 126 ms
55,684 KB
testcase_03 AC 126 ms
55,980 KB
testcase_04 AC 123 ms
54,396 KB
testcase_05 AC 127 ms
56,236 KB
testcase_06 AC 125 ms
55,804 KB
testcase_07 AC 122 ms
55,972 KB
testcase_08 AC 125 ms
55,788 KB
testcase_09 AC 125 ms
55,680 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[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        System.out.println(arr[n - 1] - arr[0]);
    }
}
0