알고리즘왕/BOJ

[백준/2675/JAVA] 문자열 반복

찌 ㅋ 2020. 3. 18. 00:45

 

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int i = 0; i < t; i++) {
			int r = sc.nextInt();
			String s = sc.next();
			for(int j = 0; j < s.length(); j++)
				for(int k=0; k<r; k++) 
					System.out.print(s.charAt(j));
			System.out.println();
		}
	}
}

 


반복문 말고는 방법이 없는 걸까유,,