結果

問題 No.21 平均の差
ユーザー aikon_marimoaikon_marimo
提出日時 2018-05-02 20:58:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 2,662 ms
コンパイル使用メモリ 74,056 KB
実行使用メモリ 58,816 KB
最終ジャッジ日時 2023-09-10 08:55:28
合計ジャッジ時間 4,872 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

		int N = in.nextInt();
		int k = in.nextInt();

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

		System.out.println(max - min);
	}
}
0