본문 바로가기

Algorithm/Baekjoon

[백준_JAVA] 2675 문자열 반복

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int testCase = sc.nextInt();
		
		for(int i = 0; i < testCase; 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();
		}

	}
}

'Algorithm > Baekjoon' 카테고리의 다른 글