結果

問題 No.21 平均の差
ユーザー bigbear90560bigbear90560
提出日時 2015-07-05 07:06:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 4,539 ms
コンパイル使用メモリ 71,556 KB
実行使用メモリ 55,872 KB
最終ジャッジ日時 2023-09-22 06:20:55
合計ジャッジ時間 6,770 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,672 KB
testcase_01 AC 138 ms
55,448 KB
testcase_02 AC 133 ms
55,872 KB
testcase_03 AC 131 ms
55,308 KB
testcase_04 AC 132 ms
55,468 KB
testcase_05 AC 134 ms
55,460 KB
testcase_06 AC 127 ms
55,460 KB
testcase_07 AC 127 ms
55,624 KB
testcase_08 AC 130 ms
55,464 KB
testcase_09 AC 131 ms
55,416 KB
権限があれば一括ダウンロードができます

ソースコード

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