結果

問題 No.21 平均の差
ユーザー aikon_marimoaikon_marimo
提出日時 2018-04-29 00:38:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 2,596 ms
コンパイル使用メモリ 71,572 KB
実行使用メモリ 56,552 KB
最終ジャッジ日時 2023-09-10 07:57:47
合計ジャッジ時間 4,649 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,612 KB
testcase_01 WA -
testcase_02 AC 124 ms
55,648 KB
testcase_03 AC 122 ms
55,864 KB
testcase_04 AC 120 ms
55,484 KB
testcase_05 AC 119 ms
55,348 KB
testcase_06 WA -
testcase_07 AC 121 ms
55,796 KB
testcase_08 AC 120 ms
55,652 KB
testcase_09 AC 117 ms
56,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int N = in.nextInt();
		int K = in.nextInt();
		int max = in.nextInt();
		int min = in.nextInt();
		for (int i = 2; i < N; i++) {
			int val = in.nextInt();
			if (val > max) {
				max = val;
			}
			if (val < min) {
				min = val;
			}
		}
		System.out.println(max - min);
	}
}
0