結果

問題 No.21 平均の差
ユーザー papipenpapipen
提出日時 2017-03-28 23:19:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 374 bytes
コンパイル時間 2,654 ms
コンパイル使用メモリ 71,332 KB
実行使用メモリ 56,184 KB
最終ジャッジ日時 2023-09-20 18:38:42
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,184 KB
testcase_01 AC 121 ms
55,500 KB
testcase_02 AC 121 ms
55,748 KB
testcase_03 AC 120 ms
55,504 KB
testcase_04 AC 118 ms
55,636 KB
testcase_05 AC 121 ms
56,112 KB
testcase_06 AC 120 ms
56,128 KB
testcase_07 AC 120 ms
55,928 KB
testcase_08 AC 123 ms
55,988 KB
testcase_09 AC 123 ms
55,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class N021{
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int k = s.nextInt();
		int max = 0;
		int min = 1000;
		int a[] = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = s.nextInt();
			max = Math.max(max, a[i]);
			min = Math.min(min, a[i]);
		}
		System.out.println(max - min);
	}
}
0