結果

問題 No.21 平均の差
ユーザー numberfromnumberfrom
提出日時 2020-05-20 09:44:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 406 bytes
コンパイル時間 5,618 ms
コンパイル使用メモリ 75,660 KB
実行使用メモリ 54,372 KB
最終ジャッジ日時 2024-04-09 22:50:34
合計ジャッジ時間 6,109 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
54,072 KB
testcase_01 AC 132 ms
54,188 KB
testcase_02 AC 124 ms
54,148 KB
testcase_03 AC 107 ms
52,828 KB
testcase_04 AC 127 ms
54,004 KB
testcase_05 AC 124 ms
54,372 KB
testcase_06 AC 111 ms
52,780 KB
testcase_07 AC 127 ms
54,000 KB
testcase_08 AC 131 ms
54,004 KB
testcase_09 AC 119 ms
53,944 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[] n = new int[N];
		int min = 100000;
		int max = 0;

		for(int i=0; i<N; i++){
			n[i] = sc.nextInt();

			max = Math.max(max, n[i]);
			min = Math.min(min, n[i]);
		}
		sc.close();

		System.out.println(max-min);

	}

}
0