알고리즘/BOJ

[C++] 백준 2657번 문자열 반복

Jay, Lee 2021. 3. 7. 23:34
#include <iostream>
#include <string>
using namespace std;

int main() {

	int testcase;
	cin >> testcase;
	for (int i = 0; i < testcase; i++) {
		int repeat;
		string s;
		cin >> repeat >> s;
		for (int k = 0; k < s.length(); k++) {
			for (int j = 0; j < repeat; j++) {
				cout << s[k];
			}
		}
		cout << "\n";
	}

	return 0;
}