結果

問題 No.21 平均の差
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 01:33:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 2,090 ms
コンパイル使用メモリ 74,864 KB
実行使用メモリ 54,272 KB
最終ジャッジ日時 2024-04-09 20:49:57
合計ジャッジ時間 3,666 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
54,120 KB
testcase_01 AC 112 ms
54,232 KB
testcase_02 AC 120 ms
54,168 KB
testcase_03 AC 122 ms
54,244 KB
testcase_04 AC 112 ms
53,560 KB
testcase_05 AC 109 ms
52,764 KB
testcase_06 AC 122 ms
54,100 KB
testcase_07 AC 109 ms
52,852 KB
testcase_08 AC 115 ms
54,272 KB
testcase_09 AC 114 ms
53,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i=0; i<n; i++) {
			int temp = sc.nextInt();
			min = Math.min(min,temp);
			max = Math.max(max,temp);
		}
		System.out.println(max-min);
	}
}
0