문제 설명
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.
별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.
예시
입력
5 3
출력
*****
*****
*****
나의 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
process.stdin.setEncoding('utf8');
process.stdin.on('data', data => {
const n = data.split(" ");
const a = Number(n[0]), b = Number(n[1]);
for(let i=0; i<b; i++){
for(let j=0; j<a; j++){
process.stdout.write('*');
}
console.log('')
}
});
|
cs |
'코딩 테스트 풀이 🛠' 카테고리의 다른 글
[Leet Code - eazy] 1470. Shuffle the Array (0) | 2023.01.28 |
---|---|
[프로그래머스] 같은 숫자는 싫어 (0) | 2023.01.22 |
[프로그래머스] 행렬의 덧셈 (0) | 2023.01.22 |
[프로그래머스] 3진법 뒤집기 (0) | 2023.01.21 |
[프로그래머스] 최대공약수와 최소공배수 (0) | 2023.01.21 |