結果

問題 No.21 平均の差
ユーザー atkrymatkrym
提出日時 2016-11-07 17:47:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 4,777 ms
コンパイル使用メモリ 71,852 KB
実行使用メモリ 55,884 KB
最終ジャッジ日時 2023-08-16 14:20:50
合計ジャッジ時間 4,026 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,360 KB
testcase_01 AC 119 ms
55,872 KB
testcase_02 AC 120 ms
55,836 KB
testcase_03 AC 122 ms
55,820 KB
testcase_04 AC 124 ms
55,708 KB
testcase_05 AC 124 ms
55,692 KB
testcase_06 AC 128 ms
55,340 KB
testcase_07 AC 121 ms
55,664 KB
testcase_08 AC 123 ms
55,784 KB
testcase_09 AC 122 ms
55,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] ary = new int[n];
        for (int i = 0;i < n;i++) {
            ary[i] = sc.nextInt();
        }
        Arrays.sort(ary);
        System.out.println(ary[n-1]-ary[0]);
    }
}
0