Algorithm/BaeKJoon
[JS][백준]2438_별 찍기 - 1
JaeKwan
2021. 7. 30. 16:10
문제 번호
2438번: 별 찍기 - 1
첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제
www.acmicpc.net
알고리즘 분류
구현
문제 풀이
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on('line', (line)=> {
input.push(line);
})
rl.on('close',()=>{
let n = Number(input[0]);
Solution(n);
process.exit();
})
function Solution(n){
for(let i=1; i<=n; i++){
answer = '';
for(let j=1; j<=i; j++){
answer += '*';
}
console.log(answer);
}
}
특이사항