結果

問題 No.21 平均の差
ユーザー SuunnSuunn
提出日時 2018-11-20 04:55:56
言語 Java
(openjdk 23)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 377 bytes
コンパイル時間 2,487 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 41,652 KB
最終ジャッジ日時 2024-12-24 15:21:32
合計ジャッジ時間 4,674 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
	

public class Main{
	
	
	public static void main(String args[])throws Exception{
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int max = 0;
		int min = 1001;
		for(int i=0;i<N;i++){
			int n = sc.nextInt();
			max = Math.max(max, n);
			min = Math.min(min, n);
		}
		System.out.println(max-min);
	}
	
}
0