結果

問題 No.289 数字を全て足そう
ユーザー intercept6intercept6
提出日時 2020-09-17 20:48:10
言語 TypeScript
(5.4.3)
結果
AC  
実行時間 81 ms / 1,000 ms
コード長 455 bytes
コンパイル時間 9,573 ms
コンパイル使用メモリ 255,120 KB
実行使用メモリ 42,800 KB
最終ジャッジ日時 2023-09-04 07:32:07
合計ジャッジ時間 12,905 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
42,352 KB
testcase_01 AC 76 ms
42,344 KB
testcase_02 AC 76 ms
42,172 KB
testcase_03 AC 77 ms
42,280 KB
testcase_04 AC 75 ms
42,176 KB
testcase_05 AC 80 ms
42,244 KB
testcase_06 AC 76 ms
42,176 KB
testcase_07 AC 78 ms
42,460 KB
testcase_08 AC 79 ms
42,452 KB
testcase_09 AC 76 ms
42,420 KB
testcase_10 AC 77 ms
42,432 KB
testcase_11 AC 78 ms
42,600 KB
testcase_12 AC 80 ms
42,512 KB
testcase_13 AC 78 ms
42,384 KB
testcase_14 AC 79 ms
42,744 KB
testcase_15 AC 79 ms
42,800 KB
testcase_16 AC 78 ms
42,504 KB
testcase_17 AC 79 ms
42,452 KB
testcase_18 AC 79 ms
42,660 KB
testcase_19 AC 80 ms
42,596 KB
testcase_20 AC 80 ms
42,476 KB
testcase_21 AC 77 ms
42,304 KB
testcase_22 AC 80 ms
42,612 KB
testcase_23 AC 81 ms
42,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import { readFileSync } from 'fs';

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

  const line = data[0].split('').map((value) => {
    const num = parseInt(value);
    if (isNaN(num)) {
      return 0;
    } else {
      return num;
    }
  });
  function reducer(accumulator: number, currentValue: number) {
    return accumulator + currentValue;
  }
  console.log(line.reduce(reducer));
}

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