結果

問題 No.21 平均の差
ユーザー abcabc
提出日時 2016-10-17 18:51:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 360 bytes
コンパイル時間 2,286 ms
コンパイル使用メモリ 74,100 KB
実行使用メモリ 41,248 KB
最終ジャッジ日時 2024-05-02 03:13:00
合計ジャッジ時間 4,149 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
41,076 KB
testcase_01 AC 134 ms
41,004 KB
testcase_02 AC 132 ms
41,248 KB
testcase_03 AC 133 ms
40,944 KB
testcase_04 AC 121 ms
39,852 KB
testcase_05 AC 120 ms
40,084 KB
testcase_06 AC 132 ms
41,112 KB
testcase_07 AC 135 ms
41,056 KB
testcase_08 AC 134 ms
41,196 KB
testcase_09 AC 137 ms
41,120 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