Algorithm/BOJ

Mangling Names - 17661

jhg0406 2020. 2. 28. 18:51
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//17661 - Mangling Names
 
#include <iostream>
using namespace std;
 
int N, K;
int ans;
int arr[31][31];
 
void init()
{
    scanf("%d%d"&N, &K);
    ans = 0;
    for(int i = 0; i<=N; ++i)
        for(int j = 0; j<=N; ++j)
            scanf("%d"&arr[i][j]);
}
 
void solve()
{
    char c;
    int x = 0, y = 0;
    while((c = getchar()) != '\n')
    {
        if(c == 'a' || c == 'u' || c == 'i' || c == 'o' || c == 'e' || c == 'y')
            ++x;
        else
            ++y;
        
    }
    ans += arr[x][y];
}
 
int main()
{
    int C; scanf("%d"&C);
    for(int tn = 0; tn<C; ++tn)
    {
        init();
        getchar();
        for(int i = 0; i <K; ++i)
            solve();
        printf("Data Set %d:\n%d\n\n", tn+1, ans);
    }
}
cs

 

 

 

 

 

 

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

 

17661번: Mangling Names

Having figured out everyone’s first and last name, it’s time for everyone to walk across that stage, to cheers of friends and family, receive a degree, and hear one’s name pronounced/mangled. One has to have some pity, though, with the poor officials who h

www.acmicpc.net

 

 

 

 

 

 

Mangling Names

자음 모음 개수만 잘 세주면 되는 문제입니다.

아무것도 없는 한줄이 input으로 들어오는 경우가 있어 input만 잘 처리해 주면됩니다!