結果

問題 No.21 平均の差
ユーザー m4s4k1ch1m4s4k1ch1
提出日時 2015-05-29 00:20:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 73,248 KB
実行使用メモリ 37,108 KB
最終ジャッジ日時 2024-07-06 10:14:39
合計ジャッジ時間 2,581 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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