結果
| 問題 | No.289 数字を全て足そう |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-17 20:48:10 |
| 言語 | TypeScript (6.0.2) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 1,000 ms |
| コード長 | 455 bytes |
| 記録 | |
| コンパイル時間 | 4,675 ms |
| コンパイル使用メモリ | 345,596 KB |
| 実行使用メモリ | 53,376 KB |
| 最終ジャッジ日時 | 2026-06-05 04:44:23 |
| 合計ジャッジ時間 | 7,975 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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'));