結果

問題 No.21 平均の差
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 23:18:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 1,985 ms
コンパイル使用メモリ 71,576 KB
実行使用メモリ 57,900 KB
最終ジャッジ日時 2023-09-09 11:51:04
合計ジャッジ時間 4,133 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,104 KB
testcase_01 AC 127 ms
55,564 KB
testcase_02 AC 125 ms
55,668 KB
testcase_03 AC 124 ms
57,900 KB
testcase_04 AC 124 ms
55,876 KB
testcase_05 AC 121 ms
54,032 KB
testcase_06 AC 122 ms
56,024 KB
testcase_07 AC 121 ms
55,940 KB
testcase_08 AC 124 ms
56,268 KB
testcase_09 AC 125 ms
55,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		int []n = new int [N];
		for(int i = 0; i < N; i++) {
			n[i] = scan.nextInt();
		}
		scan.close();
		Arrays.sort(n);
		int max = n[n.length - 1];
		int min = n[0];
		int ans = max - min;
		System.out.println(ans);

	}
}
0