algorithm'''problem solve

[백준] 9375 - 패션왕 신해빈(설명X)

JunHwa Park 2020. 4. 20. 17:32
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
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
using namespace std;
 
int main() {
    int T;
    scanf("%d"&T);
    for (int i = 0; i < T; i++) {
        int num, sets = 1;
        scanf("%d"&num);
        map<stringint> _map;
        for (int j = 0; j < num; j++) {
            string clothes;
            string category;
            cin >> clothes >> category;
            if (_map.find(category) == _map.end())
                _map[category] = 1;
            else
                _map[category]++;
        }
        for (map<string,int>::iterator iter = _map.begin(); iter != _map.end(); iter++) {
            sets *= iter->second + 1;
        }
        printf("%d\n", sets - 1);
    }
}
cs