結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー intercept6
提出日時 2020-07-16 09:47:59
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 374 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 7,761 ms
コンパイル使用メモリ 230,172 KB
実行使用メモリ 59,784 KB
最終ジャッジ日時 2024-12-31 16:15:26
合計ジャッジ時間 12,028 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import { readFileSync } from 'fs';

function Main(input: string) {
  // inputにはすべての入力の文字列が与えられるので必要に応じて input.split("\n") などで分割する。

  const data = input.split('\n');

  const array = data[1].split(' ');

  const reducer = (accumulator: string, currentValue: string) => {
    return String(BigInt(accumulator) + BigInt(currentValue));
  };

  console.log(array.reduce(reducer));
}

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