쏘ing
[Python] 백준 9375 패션왕 신해빈 본문
https://www.acmicpc.net/problem/9375
풀이
num = int(input())
for _ in range (num):
count = int(input())
dic = {}
res = count
for _ in range (count):
A, B = map(str, input().split())
# 옷 종류가 dic에 있다면 +1
if B in dic:
dic[B] += 1
# 없으면 새로 만들기
else:
dic[B] = 1
res = 1
# (옷 종류 수 + 1) * (옷 종류 수 + 1) - 1
for key in dic.keys():
res *= (dic[key] + 1)
print(res - 1)
'알고리즘 > CLASS 3' 카테고리의 다른 글
[Python] 백준 1764 듣보잡 (0) | 2022.02.21 |
---|---|
[Python] 백준 17219 비밀번호 찾기 (0) | 2022.02.21 |
[Python] 백준 1620 나는야 포켓몬 마스터 이다솜 (0) | 2022.02.21 |
[Python] 백준 1676 팩토리얼 0의 개수 (0) | 2022.02.21 |
[Python] 백준 11723 집합 (0) | 2022.02.08 |
Comments