結果

問題 No.481 1から10
コンテスト
ユーザー intercept6
提出日時 2020-09-16 09:50:39
言語 TypeScript
(6.0.2)
コンパイル:
tsc.sh -p tsconfig.json
実行:
node main.js ONLINE_JUDGE
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 488 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,503 ms
コンパイル使用メモリ 345,452 KB
実行使用メモリ 53,064 KB
最終ジャッジ日時 2026-06-05 04:44:06
合計ジャッジ時間 6,379 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import { readFileSync } from 'fs';

function reducer(accumulator: number, currentValue: number) {
  return accumulator + currentValue;
}

function Main(input: string) {
  const data = input.split('\n');

  const expectedNumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  const numbers = data[0].split(' ').map(Number);

  const expectedSum = expectedNumbers.reduce(reducer);
  const sum = numbers.reduce(reducer);

  console.log(expectedSum - sum);
}

Main(readFileSync('/dev/stdin', 'utf8'));
0