알고리즘/백준
[boj 2675] 문자열 반복 - js
jinux127
2022. 3. 19. 04:20
// 문자열 반복
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);
문제도 잘안풀리고 풀이를 봐도 쉽게 이해가 안가 회의감이 든다~~
쓸데없는 생각이 많아진다.. 쉬운 문제를 풀며 기운차리자..ㅠ