結果

問題 No.21 平均の差
ユーザー ryosuke0825ryosuke0825
提出日時 2018-04-11 05:08:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 3,573 ms
コンパイル使用メモリ 75,076 KB
実行使用メモリ 56,036 KB
最終ジャッジ日時 2023-09-09 04:03:55
合計ジャッジ時間 5,599 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,848 KB
testcase_01 AC 121 ms
55,688 KB
testcase_02 AC 120 ms
55,356 KB
testcase_03 AC 118 ms
55,616 KB
testcase_04 AC 120 ms
55,756 KB
testcase_05 AC 119 ms
55,716 KB
testcase_06 AC 120 ms
55,844 KB
testcase_07 AC 122 ms
55,752 KB
testcase_08 AC 124 ms
55,896 KB
testcase_09 AC 124 ms
56,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class No21 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		System.out.println(list.get(N - 1) - list.get(0));
	}
}
0