結果

問題 No.21 平均の差
ユーザー mits58mits58
提出日時 2016-07-09 16:57:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 341 bytes
コンパイル時間 4,470 ms
コンパイル使用メモリ 74,016 KB
実行使用メモリ 41,688 KB
最終ジャッジ日時 2024-04-21 10:44:20
合計ジャッジ時間 4,517 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
39,904 KB
testcase_01 AC 116 ms
41,688 KB
testcase_02 AC 112 ms
39,980 KB
testcase_03 AC 116 ms
41,088 KB
testcase_04 AC 105 ms
40,344 KB
testcase_05 AC 103 ms
40,268 KB
testcase_06 AC 98 ms
40,132 KB
testcase_07 AC 103 ms
40,108 KB
testcase_08 AC 111 ms
41,364 KB
testcase_09 AC 112 ms
41,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int k=sc.nextInt();
			int[] a=new int[n];
			for(int i=0;i<n;i++) a[i]=sc.nextInt();
			Arrays.sort(a);
			System.out.println(a[n-1]-a[0]);
		}
	}
}
0