// 문자열 반복
const filePath = process.platform === "linux" ? "/dev/stdin" : "input.txt";
const input = require('fs').readFileSync(filePath).toString().trim().split(/\n/);
const T = parseInt(input.shift());
const testCase = input;
const sol = (T, testCase) =>{
const result = [];
for(const item of testCase){
const [R, S] = item.split(' ');
const temp = [];
for(let i=0; i<S.length; i++){
for(let j=0; j<parseInt(R); j++){
temp.push(S[i]);
}
}
result.push(temp.join(''));
}
console.log(result.join('\n'));
}
sol(T, testCase);
문제도 잘안풀리고 풀이를 봐도 쉽게 이해가 안가 회의감이 든다~~
쓸데없는 생각이 많아진다.. 쉬운 문제를 풀며 기운차리자..ㅠ
'알고리즘 > 백준' 카테고리의 다른 글
[boj 14889] 스타트와 링크 (0) | 2022.03.25 |
---|---|
[boj 14888] 연산자 끼워넣기 -js (0) | 2022.03.24 |
[boj 16929] Two Dots -js (0) | 2022.03.17 |
[boj 7576] 토마토 -js (0) | 2022.03.14 |
[boj 2178] 미로탐색 -js (0) | 2022.03.14 |