結果

問題 No.21 平均の差
ユーザー SuunnSuunn
提出日時 2018-11-20 04:55:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 108 ms / 5,000 ms
コード長 377 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 71,780 KB
実行使用メモリ 56,456 KB
最終ジャッジ日時 2023-08-26 02:09:19
合計ジャッジ時間 3,501 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
56,136 KB
testcase_01 AC 108 ms
56,128 KB
testcase_02 AC 104 ms
55,868 KB
testcase_03 AC 107 ms
56,456 KB
testcase_04 AC 104 ms
55,572 KB
testcase_05 AC 103 ms
55,732 KB
testcase_06 AC 104 ms
56,020 KB
testcase_07 AC 104 ms
55,988 KB
testcase_08 AC 106 ms
56,100 KB
testcase_09 AC 104 ms
55,556 KB
権限があれば一括ダウンロードができます

ソースコード

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