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

[๋ฐฑ์ค€][Node.js] 2441๋ฒˆ : ๋ณ„์ฐ๊ธฐ - 4

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2021. 8. 6.

 

 

Algorithm

-  ๋ณ„์ฐ๊ธฐ - 4 -

 


 

๋ฌธ์ œ

์ฒซ์งธ ์ค„์—๋Š” ๋ณ„ N๊ฐœ, ๋‘˜์งธ ์ค„์—๋Š” ๋ณ„ N-1๊ฐœ, ..., N๋ฒˆ์งธ ์ค„์—๋Š” ๋ณ„ 1๊ฐœ๋ฅผ ์ฐ๋Š” ๋ฌธ์ œ

ํ•˜์ง€๋งŒ, ์˜ค๋ฅธ์ชฝ์„ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌํ•œ ๋ณ„(์˜ˆ์ œ ์ฐธ๊ณ )์„ ์ถœ๋ ฅํ•˜์‹œ์˜ค.

 

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

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin").toString().trim();

let value = "*".repeat(Number(input)).split("");
console.log(value.join(""));
for (let i = 0; i < Number(input) - 1; i++) {
	value[i] = " ";
	console.log(value.join(""));
}

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€