結果

問題 No.21 平均の差
ユーザー abcabc
提出日時 2016-10-17 18:51:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 360 bytes
コンパイル時間 4,641 ms
コンパイル使用メモリ 72,256 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2023-08-14 15:07:10
合計ジャッジ時間 4,427 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,964 KB
testcase_01 AC 121 ms
55,972 KB
testcase_02 AC 122 ms
56,100 KB
testcase_03 AC 121 ms
55,568 KB
testcase_04 AC 122 ms
55,908 KB
testcase_05 AC 122 ms
55,888 KB
testcase_06 AC 120 ms
56,044 KB
testcase_07 AC 119 ms
55,692 KB
testcase_08 AC 119 ms
55,496 KB
testcase_09 AC 121 ms
56,040 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