본문 바로가기

프로그래밍/백준

2675 문자열 반복

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
import java.util.*;
 
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        int R;
        String[] S = new String[T];
        String temp;
 
        for(int i=0; i<T; i++) {
            R = sc.nextInt();
            S[i] = sc.next();
            temp = "";
            for(int j=0; j<S[i].length(); j++) {
                for(int k=0; k<R; k++) {
                    temp += S[i].charAt(j);
                }
            }
            S[i] = temp;
        }
 
        for(int i=0; i<T; i++) {
            System.out.println(S[i]);
        }
    }
}
cs


'프로그래밍 > 백준' 카테고리의 다른 글

1316 그룹 단어 체커  (0) 2017.10.20
1157 단어 공부  (0) 2017.10.20
10809 알파벳 찾기  (0) 2017.10.15
11654 아스키 코드  (0) 2017.10.15
10039 평균 점수  (0) 2017.10.14