結果

問題 No.289 数字を全て足そう
ユーザー f Ox
提出日時 2021-05-18 00:14:33
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 66 ms / 1,000 ms
コード長 282 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 42,496 KB
最終ジャッジ日時 2024-10-07 05:56:03
合計ジャッジ時間 2,513 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
  let num = input.replace(/[^0-9]/g, '');
  if (num === "") {
    console.log(0);
  } else {
    let array = num.split('').map(Number);
    let sum = array.reduce((a,b)=>a+b);
    console.log(sum);
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0