結果

問題 No.289 数字を全て足そう
ユーザー megane_anko
提出日時 2021-02-27 16:50:37
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 74 ms / 1,000 ms
コード長 379 bytes
コンパイル時間 8,371 ms
コンパイル使用メモリ 230,668 KB
実行使用メモリ 44,928 KB
最終ジャッジ日時 2024-12-31 16:29:59
合計ジャッジ時間 10,783 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import * as fs from 'fs';
const input = fs.readFileSync('/dev/stdin', 'utf8');

const array = input.split('');
let resultarray = [];
let sum = 0;

for (let i = 0; i < array.length; i++) {
    if (array[i].match(/^[0-9]*$/)) {
        resultarray.push(parseInt(array[i]));
    }
}

for (let j = 0; j < resultarray.length; j++) {
    sum = sum + resultarray[j];
}
console.log(sum);
0