結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-23 17:37:29 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 192 ms / 1,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 32 ms |
| コンパイル使用メモリ | 6,940 KB |
| 実行使用メモリ | 43,264 KB |
| 最終ジャッジ日時 | 2024-06-23 17:50:42 |
| 合計ジャッジ時間 | 2,734 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
function main(input = ``) {
let lines = input.split('\n');
return Array.from(lines[0]).reduce((sum, c) => {
if (!isNaN(parseInt(c))) {
return sum + parseInt(c);
} else {
return sum;
}
}, 0);
}
const { readFileSync, existsSync } = require('fs');
const stdin = '/dev/stdin';
if (existsSync(stdin)) {
const input = readFileSync(stdin, 'utf8');
console.log(main(input));
}
module.exports = main;