Notice
Recent Posts
Recent Comments
Link
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

main

[백준-2675번/Java] 문자열 반복 본문

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

'Algorithm' 카테고리의 다른 글

[백준-11653번/Java] 소인수분해  (0) 2022.11.09
[백준-2935번/Java] 소음  (0) 2022.11.09
[백준-5355번/Java] 화성수학  (0) 2022.11.09
[백준-2914번/Java] 저작권  (0) 2022.11.09
[백준-2530번/Java] 인공지능 시계  (0) 2022.11.09
Comments