๋ฐ์ํ
์ง์ฌ๊ฐํ ๋ณ์ฐ๊ธฐ
์ด ๋ฌธ์ ์๋ ํ์ค ์ ๋ ฅ์ผ๋ก ๋ ๊ฐ์ ์ ์ n๊ณผ m์ด ์ฃผ์ด์ง๋๋ค. ๋ณ(*) ๋ฌธ์๋ฅผ ์ด์ฉํด ๊ฐ๋ก์ ๊ธธ์ด๊ฐ n, ์ธ๋ก์ ๊ธธ์ด๊ฐ m์ธ ์ง์ฌ๊ฐํ ํํ๋ฅผ ์ถ๋ ฅํด๋ณด์ธ์.
์ ํ ์กฐ๊ฑด
โ n๊ณผ m์ ๊ฐ๊ฐ 1000 ์ดํ์ธ ์์ฐ์์ ๋๋ค.
์์
์
๋ ฅ :
5 3
์ถ๋ ฅ :
*****
*****
*****
๋ฌธ์ ํ์ด
const n์๋ data.split(" ")์ ํตํด ๊ณต๋ฐฑ 1์นธ๋ง๋ค ์ชผ๊ฐ๋๋ก ํด๋๊ณ const a์๋ Number(n[0]), b์๋ Number(n[1])์ ์ ์ฅ์ํค๊ณ , ๋ง์ง๋ง์ผ๋ก const star์๋ '*'์ ๋ฐ๋ณต์ํค๋๋ก ์คํฌ๋ฆฝํธ๋ฅผ ์ง ๋ค.
process.stdin.setEncoding('utf8');
process.stdin.on('data', data => {
const n = data.split(" ");
const a = Number(n[0]), b = Number(n[1]);
const star = `${'*'.repeat(a)}\n`;
console.log(star.repeat(b));
});
๋ค๋ฅธ ํ์ด ๋ฐฉ์
for๋ฌธ์ ์ด์ฉํ์ฌ ์ถ๋ ฅ์ํค๋ ๋ฐฉ์๋ ์๋ค.
process.stdin.setEncoding('utf8');
process.stdin.on('data', data => {
const n = data.split(" ");
const a = Number(n[0]), b = Number(n[1]);
const row = '*'.repeat(a)
for(let i =0; i < b; i++){
console.log(row)
}
});
๋ฐ์ํ
'Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Algorithm] ํ๋ก๊ทธ๋๋จธ์ค Lv.1 : ํ๋ ฌ์ ๋ง์ (1) | 2022.11.16 |
---|---|
[Algorithm] ํ๋ก๊ทธ๋๋จธ์ค Lv.1 : ์ฝ๋ผ์ธ ์ถ์ธก (3) | 2022.11.15 |
[Algorithm] ํ๋ก๊ทธ๋๋จธ์ค Lv.1 : ๋ฌธ์์ด ๋ค๋ฃจ๊ธฐ ๊ธฐ๋ณธ (1) | 2022.11.14 |
[Algorithm] ํ๋ก๊ทธ๋๋จธ์ค Lv.1 : ๊ฐ์ด๋ฐ ๊ธ์ ๊ฐ์ ธ์ค๊ธฐ (1) | 2022.11.14 |
[Algorithm] ํ๋ก๊ทธ๋๋จธ์ค Lv.1 : ๊ฐ์ ์ซ์๋ ์ซ์ด (2) | 2022.11.11 |
๋๊ธ