結果
| 問題 |
No.21 平均の差
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-24 18:39:58 |
| 言語 | TypeScript (5.7.2) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 5,000 ms |
| コード長 | 564 bytes |
| コンパイル時間 | 13,007 ms |
| コンパイル使用メモリ | 264,644 KB |
| 実行使用メモリ | 42,368 KB |
| 最終ジャッジ日時 | 2025-09-24 18:40:18 |
| 合計ジャッジ時間 | 8,783 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
function solve(N: number, K: number, n: number[]): number {
let min = n[0];
let max = n[0];
for (let i = 1; i < N; i++) {
if (n[i] < min) min = n[i];
if (n[i] > max) max = n[i];
}
return max - min;
}
import * as fs from 'node:fs';
const input = fs.readFileSync('/dev/stdin', 'utf8').trim().split(/\s+/);
let index = 0;
const N = parseInt(input[index++]);
const K = parseInt(input[index++]);
const n: number[] = [];
for (let i = 0; i < N; i++) {
n.push(parseInt(input[index++]));
}
console.log(solve(N, K, n));