結果

問題 No.21 平均の差
ユーザー fungsi
提出日時 2025-09-24 18:42:51
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 431 bytes
コンパイル時間 8,037 ms
コンパイル使用メモリ 264,808 KB
実行使用メモリ 42,368 KB
最終ジャッジ日時 2025-09-24 18:43:01
合計ジャッジ時間 8,716 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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++]));
}

// Direct calculation without function
const min = Math.min(...n);
const max = Math.max(...n);
const result = max - min;

console.log(result);
0