結果
| 問題 |
No.21 平均の差
|
| ユーザー |
|
| 提出日時 | 2024-03-07 01:58:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 5,000 ms |
| コード長 | 1,325 bytes |
| コンパイル時間 | 1,954 ms |
| コンパイル使用メモリ | 78,332 KB |
| 実行使用メモリ | 50,992 KB |
| 最終ジャッジ日時 | 2024-09-29 18:38:36 |
| 合計ジャッジ時間 | 3,238 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.io.*;
import java.util.stream.*;
// 処理
class Process {
private PrintWriter printWriter;
private int[] n;
Process(PrintWriter printWriter, int[] n) {
this.printWriter = printWriter;
this.n = n;
}
// 結果を出力
void printResult() throws IOException {
printWriter.println(IntStream.of(n).max().getAsInt() - IntStream.of(n).min().getAsInt());
}
}
public class Main {
public static void main(String[] args) throws IOException {
var bufferedReader = new BufferedReader(new InputStreamReader(System.in));
var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
// 入力
int N = Integer.parseInt(bufferedReader.readLine().trim());
int K = Integer.parseInt(bufferedReader.readLine().trim());
int[] n = new int[N];
for(int i = 0; i < N; i++) {
n[i] = Integer.parseInt(bufferedReader.readLine().trim());
}
// Process クラスで処理を行う
var process = new Process(printWriter, n);
process.printResult();
// 各ストリームを閉じる
// 出力ストリームを閉じるときに標準出力に文字を出力する
bufferedReader.close();
printWriter.close();
}
}