結果

問題 No.21 平均の差
ユーザー kou6839kou6839
提出日時 2014-11-16 15:46:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 378 bytes
コンパイル時間 1,988 ms
コンパイル使用メモリ 71,364 KB
実行使用メモリ 56,492 KB
最終ジャッジ日時 2023-08-30 07:08:15
合計ジャッジ時間 4,050 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,156 KB
testcase_01 AC 122 ms
56,492 KB
testcase_02 AC 125 ms
55,856 KB
testcase_03 AC 124 ms
56,460 KB
testcase_04 AC 122 ms
55,872 KB
testcase_05 AC 122 ms
55,748 KB
testcase_06 AC 122 ms
55,896 KB
testcase_07 AC 121 ms
55,540 KB
testcase_08 AC 121 ms
55,716 KB
testcase_09 AC 122 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int max=0;
		int min=Integer.MAX_VALUE;
		for(int i=0;i<n;i++){
			int temp=sc.nextInt();
			max=Math.max(max, temp);
			min=Math.min(min, temp);
		}
		System.out.println(max-min);
	}
}
0