practivceAlgorithm/백준
[백준][Python] 9375 패션왕 신해빈
findTheValue
2021. 9. 7. 03:54
모든 조합의 경우의 수는 (각 종의 수+1(안 입거나 무언갈 입거나의 경우의 수)) 의 곱 -1(아무것도 안 입는 경우의 수)
import sys
input = sys.stdin.readline
from collections import defaultdict
for _ in range(int(input())):
n = int(input())
clothes = defaultdict(int)
ans = 1
for _ in range(n):
name, type_c = input().split()
clothes[type_c] += 1
for cloth in clothes:
ans *= clothes[cloth]+1
print(ans-1)