結果

問題 No.21 平均の差
ユーザー m4s4k1ch1m4s4k1ch1
提出日時 2015-05-29 00:20:07
言語 Java19
(openjdk 21)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 1,825 ms
コンパイル使用メモリ 71,724 KB
実行使用メモリ 49,400 KB
最終ジャッジ日時 2023-09-20 15:06:19
合計ジャッジ時間 2,986 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,224 KB
testcase_01 AC 43 ms
49,296 KB
testcase_02 AC 42 ms
49,388 KB
testcase_03 AC 42 ms
49,264 KB
testcase_04 AC 43 ms
49,272 KB
testcase_05 AC 42 ms
48,920 KB
testcase_06 AC 43 ms
49,008 KB
testcase_07 AC 42 ms
49,304 KB
testcase_08 AC 43 ms
49,400 KB
testcase_09 AC 43 ms
49,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int n = Integer.parseInt(line);
		line = br.readLine();
//		int k = Integer.parseInt(line);
		int min = 1000;
		int max = 0;
		for (int i = 0; i < n; i++) {
			int t = Integer.parseInt(br.readLine());
			if (min > t) {
				min = t;
			}
			if (max < t) {
				max = t;
			}
		}
		
		System.out.println(max - min);
	}
}
0