結果

問題 No.21 平均の差
ユーザー spaciaspacia
提出日時 2015-12-16 10:28:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 71,648 KB
実行使用メモリ 49,720 KB
最終ジャッジ日時 2023-10-14 10:45:48
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,712 KB
testcase_01 AC 43 ms
49,016 KB
testcase_02 AC 42 ms
49,212 KB
testcase_03 AC 43 ms
49,420 KB
testcase_04 AC 42 ms
49,340 KB
testcase_05 AC 42 ms
49,720 KB
testcase_06 AC 42 ms
49,076 KB
testcase_07 AC 42 ms
49,156 KB
testcase_08 AC 43 ms
49,252 KB
testcase_09 AC 42 ms
49,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main21 {
	
	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[] nums = new int[n];
		int max = 0, min = 1001;
		for (int i = 0; i < n; i++) {
			nums[i] = Integer.parseInt(br.readLine());
			max = Math.max(max, nums[i]);
			min = Math.min(min, nums[i]);
		}
		
		System.out.println(max - min);
	}
}
0