結果

問題 No.21 平均の差
ユーザー bigbear90560
提出日時 2015-07-05 07:06:40
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 3,621 ms
コンパイル使用メモリ 74,776 KB
実行使用メモリ 41,560 KB
最終ジャッジ日時 2024-07-07 23:03:13
合計ジャッジ時間 5,786 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class AverageDiff {

	public static void main(String[] args) {
		// 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
    	int c = 0;
    	int min = 1000;
    	int max = 0;
    	
        for (int i=0;i<a;i++) {
        	c = sc.nextInt();
        	if (min > c) min = c; 
        	if (max < c) max = c; 
        }
        System.out.println(max-min);
	}

}
0