알고리즘

C++ 알고리즘 - 백준 2675 문자열 반복

마루설아 2024. 12. 14. 21:59

https://www.acmicpc.net/problem/2675

 

#include <iostream>
using namespace std;

int main(void) {
	// C++ Init
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int in;

	int dup;
	string str;

	cin >> in;

	for (int i = 0; i < in; i++) {
		cin >> dup >> str;
		int leng = str.length();

		for (int j = 0; j < leng; j++) {

			for (int k = 0; k < dup; k++) {
				cout << str[j];
			}
		}

		cout << "\n";
	}
}