結果

問題 No.21 平均の差
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 16:00:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 74,192 KB
実行使用メモリ 41,644 KB
最終ジャッジ日時 2024-05-01 09:14:59
合計ジャッジ時間 3,508 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
41,424 KB
testcase_01 AC 106 ms
41,588 KB
testcase_02 AC 117 ms
41,360 KB
testcase_03 AC 106 ms
41,252 KB
testcase_04 AC 121 ms
41,416 KB
testcase_05 AC 116 ms
41,588 KB
testcase_06 AC 114 ms
41,384 KB
testcase_07 AC 110 ms
41,644 KB
testcase_08 AC 109 ms
41,240 KB
testcase_09 AC 109 ms
41,468 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