結果
| 問題 | No.21 平均の差 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-17 13:19:25 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 5,000 ms |
| コード長 | 603 bytes |
| 記録 | |
| コンパイル時間 | 2,787 ms |
| コンパイル使用メモリ | 83,924 KB |
| 実行使用メモリ | 47,088 KB |
| 最終ジャッジ日時 | 2026-04-04 08:59:26 |
| 合計ジャッジ時間 | 5,539 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class No00000021_Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
scan.nextLine();
scan.nextLine();
List<Integer> arr = new ArrayList<Integer>();
for(int i = 0; i < n; i++) {
arr.add(Integer.parseInt(scan.nextLine()));
}
int max = arr.get(0);
int min = arr.get(0);
for(int num : arr) {
if(max < num) {
max = num;
} else if(num < min) {
min = num;
}
}
System.out.println(max - min);
scan.close();
}
}