let's get IT with DAVINA ๐Ÿ’ป

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] Lv0. ์ง๊ฐ์‚ผ๊ฐํ˜• ์ถœ๋ ฅํ•˜๊ธฐ ๋ณธ๋ฌธ

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

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

๋‹ค๋นˆ์น˜์ฝ”๋“œ๐Ÿ’Ž 2023. 3. 10. 13:44

โ“ ๋ฌธ์ œ ์„ค๋ช…

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

๐Ÿšซ ์ œํ•œ์‚ฌํ•ญ

  • 1 ≤ n ≤ 10

๐Ÿ—๏ธ ์ž…์ถœ๋ ฅ ์˜ˆ

์ž…๋ ฅ #1

3

์ถœ๋ ฅ #1

*
**
***
๋ณ„์ฐ๊ธฐ ๋ฌธ์ œ์™€ ๋™์ผํ•œ ๊ตฌํ˜„

โ—๏ธ๋น„๋‹ˆ's ํ’€์ด

์ฒ˜์Œ์— ์ฃผ์–ด์ง„ ์ฝ”๋“œ๋“ค์„ ๋ณด๊ณ  ์ด๊ฒŒ ๋ญ”๊ฐ€ํ•˜๊ณ  ๋‹นํ™ฉํ–ˆ์ง€๋งŒ..์–ด์ฐŒ๋๊ฑด n์„ ์ž…๋ ฅ๋ฐ›์•˜์„ ๋•Œ ๋ณ„์ฐ๊ธฐ ๋ฌธ์ œ์™€ ๋™์ผํ•œ ํŒจํ„ด์œผ๋กœ ๋ณด์˜€๋‹ค..

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 n= Number(input[0]);
    let res= "";
    for(let i=0;i<n;i++){ //๋ช‡ ์ค„?
        for(let j=0;j<=i;j++){ //๊ทธ ์ค„์— ๋ณ„ ๋ช‡๊ฐœ?
            res=res+"*"; //๋ณ„์ฐ๊ธฐ
        }
        res=res+'\n' //์ค„๋ฐ”๊ฟˆ
    }
    console.log(res);
});
Comments