Algorithm
[백준-2675번/Java] 문자열 반복
1984
2022. 11. 9. 20:28
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = Integer.parseInt(sc.nextLine());
for (int i = 0; i < num; i++) {
int repeat = sc.nextInt();
String str = sc.next();
for (char c : str.toCharArray()) {
for (int j = 0; j < repeat; j++) {
System.out.print(c);
}
}
System.out.println();
}
}
}
728x90