반응형

문제출처

https://www.acmicpc.net/problem/2675


문제풀이

이중 for문을 사용하면 되는 간단한 문제


소스코드

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <cstring>
int main() {
    int tc, repeat, len;
    char s[21];
    scanf("%d"&tc);
    while(tc--) {
        scanf("%d %s"&repeat, &s);
        len=strlen(s);
        for(int i=0; i<len; i++) {
            for(int j=0; j<repeat; j++) {
                printf("%c", s[i]);
            }
        }
        printf("\n");
    }
    return 0;
}
cs


반응형

'Algorithm' 카테고리의 다른 글

[BOJ 1655] 가운데를 말해요  (0) 2019.04.16
[BOJ 1157] 단어공부  (0) 2019.04.15
[BOJ 13458] 시험감독  (0) 2019.04.15
[BOJ 1057] 토너먼트  (0) 2019.04.15
[BOJ 1094] 막대기  (0) 2019.04.15

+ Recent posts