結果

問題 No.21 平均の差
ユーザー discoNekodiscoNeko
提出日時 2016-04-29 00:45:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 593 bytes
コンパイル時間 2,527 ms
コンパイル使用メモリ 75,064 KB
実行使用メモリ 37,324 KB
最終ジャッジ日時 2024-04-15 05:17:43
合計ジャッジ時間 2,986 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
37,060 KB
testcase_01 AC 50 ms
37,208 KB
testcase_02 AC 49 ms
37,324 KB
testcase_03 AC 48 ms
36,804 KB
testcase_04 AC 49 ms
37,096 KB
testcase_05 AC 49 ms
37,288 KB
testcase_06 AC 48 ms
37,292 KB
testcase_07 AC 49 ms
36,816 KB
testcase_08 AC 50 ms
37,292 KB
testcase_09 AC 48 ms
37,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int k = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(br.readLine());
		}
		Arrays.sort(a);
		sb.append(a[n-1]-a[0]);
		System.out.println(sb);
	}
}
0