Algorithm
- ๋ํ๊ธฐ -
๋ฌธ์
10๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ ์์ฐ์ N๊ฐ๋ฅผ ์ฃผ๋ฉด ํฉ์ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
์ ์ถ๋ ฅ ์์
๋ฌธ์ ํ๊ธฐ
let fs = require("fs");
let input = fs.readFileSync("/dev/stdin")
.toString()
.split("\n");
input.shift();
let result = [];
for (let i = 1; i < input.length; i += 2) {
let arr = input[i].split(' ').map(el => Number(el));
result.push(arr.reduce((past, curr) => past + curr, 0));
}
console.log(result.join('\n'));
๋ฐ์ํ
'๊ฐ์ธ๊ณต๋ถ > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][Node.js] 9093๋ฒ : ๋จ์ด ๋ค์ง๊ธฐ (0) | 2021.12.21 |
---|---|
[๋ฐฑ์ค][Node.js] 9086๋ฒ : ๋ฌธ์์ด (0) | 2021.12.19 |
[๋ฐฑ์ค][Node.js] 9076๋ฒ : ์ ์ ์ง๊ณ (0) | 2021.12.17 |
[๋ฐฑ์ค][Node.js] 9012๋ฒ : ๊ดํธ (0) | 2021.12.16 |
[๋ฐฑ์ค][Node.js] 8958๋ฒ : OXํด์ฆ (0) | 2021.12.15 |
๋๊ธ