結果

問題 No.21 平均の差
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 16:00:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 2,146 ms
コンパイル使用メモリ 71,448 KB
実行使用メモリ 56,160 KB
最終ジャッジ日時 2023-08-13 16:28:07
合計ジャッジ時間 4,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,588 KB
testcase_01 AC 125 ms
55,812 KB
testcase_02 AC 123 ms
55,520 KB
testcase_03 AC 124 ms
56,160 KB
testcase_04 AC 123 ms
55,924 KB
testcase_05 AC 125 ms
55,716 KB
testcase_06 AC 124 ms
55,740 KB
testcase_07 AC 123 ms
55,548 KB
testcase_08 AC 123 ms
55,604 KB
testcase_09 AC 123 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

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

0