結果

問題 No.21 平均の差
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-23 13:29:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 704 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 71,660 KB
実行使用メモリ 49,680 KB
最終ジャッジ日時 2023-09-29 01:28:16
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,168 KB
testcase_01 AC 44 ms
49,472 KB
testcase_02 AC 44 ms
49,128 KB
testcase_03 AC 46 ms
49,380 KB
testcase_04 AC 43 ms
49,336 KB
testcase_05 AC 43 ms
49,628 KB
testcase_06 AC 44 ms
49,376 KB
testcase_07 AC 43 ms
49,276 KB
testcase_08 AC 43 ms
49,680 KB
testcase_09 AC 43 ms
49,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        int K = Integer.parseInt(reader.readLine());
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int n = Integer.parseInt(reader.readLine());
            max = Math.max(max,n);
            min = Math.min(min,n);
        }
        int difference = (max - min);
        System.out.println(difference);
    }
}
0