๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ์ธ๊ณต๋ถ€/Algorithm

[๋ฐฑ์ค€][Node.js] 5522๋ฒˆ : ์นด๋“œ ๊ฒŒ์ž„

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2021. 11. 16.

 

 

Algorithm

-  ์นด๋“œ ๊ฒŒ์ž„ -

 


 

๋ฌธ์ œ

JOI๊ตฐ์€ ์นด๋“œ ๊ฒŒ์ž„์„ ํ•˜๊ณ  ์žˆ๋‹ค.

์ด ์นด๋“œ ๊ฒŒ์ž„์€ 5ํšŒ์˜ ๊ฒŒ์ž„์œผ๋กœ ์ง„ํ–‰๋˜๋ฉฐ, ๊ทธ ์ด์ ์œผ๋กœ ์Šน๋ถ€๋ฅผ ํ•˜๋Š” ๊ฒŒ์ž„์ด๋‹ค.

 

JOI๊ตฐ์˜ ๊ฐ ๊ฒŒ์ž„์˜ ๋“์ ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ •์ˆ˜๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, JOI๊ตฐ์˜ ์ด์ ์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜๋ผ.

 

์ž…์ถœ๋ ฅ ์˜ˆ์‹œ

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin")
	.toString()
	.split("\n")
	.map((el) => Number(el));

console.log(input.reduce((past, curr) => past + curr, 0));

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€