let's get IT with DAVINA ๐Ÿ’ป

[๋ฐฑ์ค€] ์•Œ๊ณ ๋ฆฌ์ฆ˜ nodejs๋กœ ํ’€๊ธฐ setting ๋ณธ๋ฌธ

DEV_IN/๋ฌธ์ œํ’€์ด

[๋ฐฑ์ค€] ์•Œ๊ณ ๋ฆฌ์ฆ˜ nodejs๋กœ ํ’€๊ธฐ setting

๋‹ค๋นˆ์น˜์ฝ”๋“œ๐Ÿ’Ž 2023. 3. 13. 18:55
ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค๋กœ๋งŒ ํ•˜๋ ค๋‹ค๊ฐ€ ๋ฐ”ํ‚น๋… ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ฐœ๋…์„ ๋ฐฐ์šฐ๋ฉด ํ•ด๋‹น ์œ ํ˜•์„ ๋ฐ”๋กœ ๋ณต์Šตํ•˜๊ณ  ์‹ถ์–ด์„œ ๋ฐฑ์ค€๋„ ๋ณ‘ํ–‰ํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค! ๋ฐฑ์ค€..nodejs๋กœ ํ’€๋ ค๊ณ  ํ•˜๋‹ˆ ๋„ˆ๋ฌด ์–ด๋ ค์›Œ์„œ ํ•˜๋ฃจ์ฃ™์ผ ์ด๊ฒƒ๋งŒ ์•Œ์•„๋ดค๋‹คใ… ใ… 

์ž…๋ ฅ๊ฐ’ ๋ฐ›๊ธฐ

7
pop
top
push 123
top
pop
top
pop
  • fs : fs(file system) ๋ชจ๋“ˆ๋กœ ๋ฐ›์•„์™€์•ผ ํ•œ๋‹ค. (์ž…๋ ฅ ํŒŒ์ผ์˜ ๊ฒฝ๋กœ๋Š” "/dev/stdin")
  • input : input.txt์™€ ๊ฐ™์€ ํŒŒ์ผ์˜ ๊ฐ’์„ string์œผ๋กœ ๋ณ€ํ™˜ํ•ด์ฃผ๊ธฐ
// 1. ์ž…๋ ฅ๊ฐ’์ด ํ•œ ๊ฐœ์ผ ๋•Œ(ํ•œ ์ค„)
const fs = require('fs');
const input = fs.readFileSync("/dev/stdin").toString().trim();
// 2. ์ž…๋ ฅ๊ฐ’์ด ์—ฌ๋Ÿฌ ๊ฐœ์ผ ๋•Œ(ํ•œ ์ค„์— ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„)
/* ex)
110 78 158
*/
const fs = require('fs');
const input = fs.readFileSync("/dev/stdin").toString().trim().split(" ");
// 3. ์ž…๋ ฅ๊ฐ’์ด ์—ฌ๋Ÿฌ ์ค„์ผ ๋•Œ
/* ex)
110
78
158
*/
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
// 4. ์ž…๋ ฅ๊ฐ’์ด ์ฒซ ๋ฒˆ์งธ ์ค„์—๋Š” ์ž…๋ ฅ ๊ฐ’์˜ ๊ธธ์ด(n), ๋‘ ๋ฒˆ์งธ ์ค„์— ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ์ž…๋ ฅ๊ฐ’์ด ์ฃผ์–ด์งˆ ๋•Œ
/* ex)
3
110 78 158
*/
const fs = require('fs');
const [n, input] = fs.readFileSync("/dev/stdin").toString().trim().split("\n");
const inputArr = input.trim().split(" ")
// 5. ์ž…๋ ฅ๊ฐ’์ด ์ฒซ ๋ฒˆ์งธ ์ค„์—๋Š” ์ž…๋ ฅ ๊ฐ’์˜ ๊ธธ์ด(n), n๊ฐœ์˜ ์ค„์— ๊ฑธ์ณ์„œ ํ•œ ์ค„์— ํ•˜๋‚˜์˜ ์ž…๋ ฅ๊ฐ’์ด ์ฃผ์–ด์งˆ ๋•Œ
/* ex)
3
110
78
158
*/
const fs = require('fs');
const [n, input] = fs.readFileSync("/dev/stdin").toString().trim().split("\n");
Comments