본문 바로가기

BOJ

[백준] 2675번 문자열 반복 c++

#include <iostream>

using namespace std;

int main(void) {
	ios::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);

	int num,number;
	string str;
	cin >> num;
	for (int i = 0; i < num; i++) {
		cin >> number >> str;
		for (int j = 0; j < str.length(); j++) {
			for (int k = 0; k < number; k++) {
				cout << str[j];
			}
		}
		cout << "\n";
	}
	return 0;
}

'BOJ' 카테고리의 다른 글