9375번: 패션왕 신해빈

myeongrangcoding·2023년 12월 26일
0

백준

목록 보기
38/47

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

풀이

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;

int main()
{
	//freopen("input.txt", "rt", stdin);

	int CntCase{}, CntClothes{};
	cin >> CntCase;

	for (int i{}; i < CntCase; ++i)
	{
		cin >> CntClothes;

		unordered_map<string, int> UmClothes;
		string StrClothes{}, StrClothesCategory{};

		for (int j{}; j < CntClothes; ++j)
		{
			cin >> StrClothes >> StrClothesCategory;
			++UmClothes[StrClothesCategory];
		}

		int Sum{1};
		for (auto& Clothes : UmClothes)
		{
			Sum *= (Clothes.second + 1);
		}
		cout << Sum - 1 << '\n';
	}

	return 0;
}
profile
명랑코딩!

0개의 댓글