結果

問題 No.21 平均の差
ユーザー suiginginsuigingin
提出日時 2015-07-07 01:51:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 3,357 ms
コンパイル使用メモリ 72,236 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2023-09-22 09:13:17
合計ジャッジ時間 5,532 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,896 KB
testcase_01 AC 125 ms
56,108 KB
testcase_02 AC 126 ms
55,564 KB
testcase_03 AC 126 ms
55,980 KB
testcase_04 AC 128 ms
56,120 KB
testcase_05 AC 124 ms
55,548 KB
testcase_06 AC 124 ms
55,808 KB
testcase_07 AC 121 ms
56,132 KB
testcase_08 AC 124 ms
55,704 KB
testcase_09 AC 122 ms
56,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class No_021 {
	Scanner sc = new Scanner(System.in);

	void run() {
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] n = new int[N];
		for (int i = 0; i < N; i++) n[i] = sc.nextInt();
		Arrays.sort(n);
		int max = n[N-1];
		int min = n[0];
		System.out.println(max - min);
	}

	public static void main(String[] args) {
		new No_021().run();
	}
}
0