[JS][백준]2438_별 찍기 - 1
Algorithm/BaeKJoon

[JS][백준]2438_별 찍기 - 1

문제 번호

 

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);
  }
}

특이사항

 

 

'Algorithm > BaeKJoon' 카테고리의 다른 글

[JS][백준]10871_X보다 작은 수  (0) 2021.07.30
[JS][백준]2439_별 찍기 - 2  (0) 2021.07.30
[JS][백준]11022_A+B - 8  (0) 2021.07.30
[JS][백준]11021_ A+B - 7  (0) 2021.07.30
[JS][백준]2741_N 찍기  (0) 2021.07.30