본문 바로가기
Computer Science

늘어지는 소리 만들기

by OKOK 2019. 2. 12.

1. 늘어지는 소리 만들기

2. 카운트 숫자 세두고

3. 출력하기 순서에 딸

4. 오케이 


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
#include <stdio.h>
 
int main(void)
{
    freopen("input.txt""r", stdin);
    int T;
    scanf(" %d"&T);
    for (int tc = 1; tc <= T; tc++)
    {
        char str[21];
        int i, H, cnt[21= {};
        scanf(" %s %d", str, &H);
        while (H--)
        {
            int pos;
            scanf(" %d"&pos);
            cnt[pos]++;
        }
        printf("#%d ", tc);
        for (i = 0; str[i]; i++)
        {
            while (cnt[i]--)
                printf("-");
            printf("%c", str[i]);
        }
        while (cnt[i]--);
            printf("-");
        printf("\n");
    }
    return 0;
}
cs

 


'Computer Science' 카테고리의 다른 글

재미있는 오셀로 게임  (0) 2019.02.12
러시아 국기 같은 깃발  (0) 2019.02.12
콩순이의 가장 싼 팰린드롬  (0) 2019.02.12
테네스의 특별한 소수  (0) 2019.02.12
콩순이의 팰린드롬  (0) 2019.02.12

댓글