매일코테

백준 6단계 no.4

공주맛밤 2022. 7. 23. 15:20

import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        String[] arr = new String[n];

        for (int i = 0; i < n; i++) {
            int m = sc.nextInt();
            String str = sc.next();
            char[] arr2 = new char[m * str.length()];

            int k = 0;
            for (int j = 0; j < str.length(); j ++) {
                Arrays.fill(arr2, k, k+m, str.charAt(j));
                k += m;
            }

            arr[i] = new String(arr2);
        }

        for (String s : arr) {
            System.out.println(s);
        }
    }
}
728x90
반응형

'매일코테' 카테고리의 다른 글

백준 6단계 no.6  (0) 2022.07.23
백준 6단계 no.5  (0) 2022.07.23
백준 6단계 no.3  (0) 2022.07.23
백준 6단계 no.2  (0) 2022.07.23
백준 6단계 no.1  (0) 2022.07.23