結果
| 問題 |
No.21 平均の差
|
| ユーザー |
|
| 提出日時 | 2021-02-17 13:19:25 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 5,000 ms |
| コード長 | 603 bytes |
| コンパイル時間 | 3,720 ms |
| コンパイル使用メモリ | 79,752 KB |
| 実行使用メモリ | 54,048 KB |
| 最終ジャッジ日時 | 2024-09-14 00:19:50 |
| 合計ジャッジ時間 | 5,462 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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();
}
}