結果

問題 No.21 平均の差
ユーザー sasakkisasakki
提出日時 2016-03-12 17:03:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 388 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 73,960 KB
実行使用メモリ 57,640 KB
最終ジャッジ日時 2023-10-25 08:07:32
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,488 KB
testcase_01 AC 127 ms
57,608 KB
testcase_02 AC 125 ms
57,504 KB
testcase_03 AC 126 ms
57,304 KB
testcase_04 AC 131 ms
57,508 KB
testcase_05 AC 125 ms
57,320 KB
testcase_06 AC 127 ms
57,392 KB
testcase_07 AC 126 ms
55,764 KB
testcase_08 AC 127 ms
57,600 KB
testcase_09 AC 126 ms
57,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class main{
    public static void main(String args[]){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();
	int K = scan.nextInt();

	int max = 0;
	int min = 1000;

	for(int i = 0; i < N; i++){
	    int num = scan.nextInt();

	    max = Math.max(max, num);
	    min = Math.min(min, num);
	    
	}

	System.out.printf("%d\n", max - min);

    }
}
0