結果

問題 No.21 平均の差
ユーザー jp_stejp_ste
提出日時 2016-02-18 07:24:19
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 2,516 ms
コンパイル使用メモリ 74,364 KB
実行使用メモリ 54,460 KB
最終ジャッジ日時 2024-09-22 11:38:24
合計ジャッジ時間 4,205 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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