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)

'practivceAlgorithm > 백준' 카테고리의 다른 글

[백준][Python] 10026 적록색약  (0) 2021.09.07
[백준][Python] 9461 파도반 수열  (0) 2021.09.07
[백준][Python] 9019 DSLR  (0) 2021.09.07
[백준][Python] 7569 토마토  (0) 2021.09.07
[백준][Python] 5525 IOIOI  (0) 2021.09.07