結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
|
提出日時 | 2020-09-17 20:48:10 |
言語 | TypeScript (5.7.2) |
結果 |
AC
|
実行時間 | 68 ms / 1,000 ms |
コード長 | 455 bytes |
コンパイル時間 | 8,502 ms |
コンパイル使用メモリ | 229,224 KB |
実行使用メモリ | 45,164 KB |
最終ジャッジ日時 | 2024-12-31 16:19:49 |
合計ジャッジ時間 | 10,262 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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'));