๐Ÿ“[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ์ง๊ฐ์‚ผ๊ฐํ˜• ์ถœ๋ ฅํ•˜๊ธฐ

Chobbyยท2022๋…„ 10์›” 12์ผ
1

Programmers

๋ชฉ๋ก ๋ณด๊ธฐ
81/349

๐Ÿงก๋ฌธ์ œ ์„ค๋ช…

""์˜ ๋†’์ด์™€ ๋„ˆ๋น„๋ฅผ 1์ด๋ผ๊ณ  ํ–ˆ์„ ๋•Œ, ""์„ ์ด์šฉํ•ด ์ง๊ฐ ์ด๋“ฑ๋ณ€ ์‚ผ๊ฐํ˜•์„ ๊ทธ๋ฆฌ๋ ค๊ณ ํ•ฉ๋‹ˆ๋‹ค. ์ •์ˆ˜ n ์ด ์ฃผ์–ด์ง€๋ฉด ๋†’์ด์™€ ๋„ˆ๋น„๊ฐ€ n ์ธ ์ง๊ฐ ์ด๋“ฑ๋ณ€ ์‚ผ๊ฐํ˜•์„ ์ถœ๋ ฅํ•˜๋„๋ก ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด๋ณด์„ธ์š”.


๐Ÿ’›์ œํ•œ์‚ฌํ•ญ

  • 1 โ‰ค n โ‰ค 100

๐Ÿ’š์ž…์ถœ๋ ฅ ์˜ˆ

์ž…๋ ฅ #1

3

์ถœ๋ ฅ #1

*
**
***

๐Ÿ’™์ž…์ถœ๋ ฅ ์˜ˆ ์„ค๋ช…

์ž…์ถœ๋ ฅ ์˜ˆ #1

  • n์ด 3์ด๋ฏ€๋กœ ์ฒซ์งธ ์ค„์— 1๊ฐœ, ๋‘˜์งธ ์ค„์— 2๊ฐœ, ์…‹์งธ ์ค„์— * 3๊ฐœ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ’œ๋‚˜์˜ ํ’€์ด

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let input = [];

rl.on('line', function (line) {
    input = line.split(' ');
}).on('close', function () {
    const num = Number(input[0]);
    let logStr = ''
    for(let i = 0 ; i < num; i++) {
        for(let j = 0 ; j <= i; j++) {
            logStr+='*'
        }
        logStr+='\n'
    }
    console.log(logStr)
});
profile
๋‚ด ์ง€์‹์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋Š” ๋Œ€๋‹ดํ•จ

0๊ฐœ์˜ ๋Œ“๊ธ€