結果

問題 No.21 平均の差
ユーザー face4face4
提出日時 2018-04-16 21:23:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 589 bytes
コンパイル時間 2,515 ms
コンパイル使用メモリ 73,084 KB
実行使用メモリ 49,492 KB
最終ジャッジ日時 2023-09-09 10:57:10
合計ジャッジ時間 3,743 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
48,956 KB
testcase_01 AC 42 ms
49,168 KB
testcase_02 AC 42 ms
49,452 KB
testcase_03 AC 42 ms
49,196 KB
testcase_04 AC 42 ms
49,316 KB
testcase_05 AC 42 ms
49,196 KB
testcase_06 AC 42 ms
49,492 KB
testcase_07 AC 41 ms
49,152 KB
testcase_08 AC 42 ms
49,336 KB
testcase_09 AC 42 ms
49,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int k = Integer.parseInt(br.readLine());
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = Integer.parseInt(br.readLine());
        }
        Arrays.sort(arr);

        System.out.println((arr[n-1] - arr[0]));
    }
}
0