본문 바로가기
Problem Solving

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

by JYHAN 2020. 7. 9.

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

 

import java.util.Scanner;

public class BOJ_2675_문자열반복 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int T = sc.nextInt();
		
		while((T--)>0) {
			int cnt = sc.nextInt();
			String s = sc.next();
			for(int i=0; i<s.length(); i++) {
				for(int j=0; j<cnt; j++) {
					System.out.print(s.charAt(i));
				}
			}
			System.out.println();
		}
	}
}

댓글