PS(중단)/BOJ

[2675] 문자열 반복 (C++)

히명 2024. 4. 25. 14:39
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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

	int n, r;
	cin >> n;
	string str;

	for (int i = 0; i < n; i++) {
		cin >> r >> str;
		for (int j = 0; j < str.size(); j++)
		{
			for (int k = 0; k < r; k++)
				cout << str[j];
		}
		cout << endl;
	}
	

	return 0;
}

 

1. n번의 반복 테스트 케이스를 받음

2. r번의 반복 횟수를 받고 str에 문자열 받음

 

줄바꿈 빼먹어서 틀린 문제(...)