結果

問題 No.21 平均の差
ユーザー yun_appyun_app
提出日時 2016-05-09 12:42:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 797 bytes
コンパイル時間 2,327 ms
コンパイル使用メモリ 74,240 KB
実行使用メモリ 37,208 KB
最終ジャッジ日時 2024-04-15 14:55:21
合計ジャッジ時間 3,504 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
36,564 KB
testcase_01 AC 56 ms
37,208 KB
testcase_02 AC 56 ms
36,932 KB
testcase_03 AC 60 ms
37,056 KB
testcase_04 AC 55 ms
37,160 KB
testcase_05 AC 57 ms
37,116 KB
testcase_06 AC 55 ms
36,588 KB
testcase_07 AC 57 ms
37,100 KB
testcase_08 AC 58 ms
37,112 KB
testcase_09 AC 57 ms
36,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int k = Integer.parseInt(br.readLine());
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            String line = br.readLine();
            max = Math.max(max,Integer.parseInt(line));
            min = Math.min(min,Integer.parseInt(line));
        }
        System.out.println(max-min);
    }
}
0