https://programmers.co.kr/learn/courses/30/lessons/42578
def solution(clothes):
diction = {}
for name, ctype in clothes:
if ctype in diction:
diction[ctype].append(name)
else:
diction[ctype] = [name]
ans = 1
for key in diction:
ans *= len(diction[key]) + 1
return ans - 1
백준에서 한번 틀렸던 문제인데 또 틀렸다..
접근방식이 아예 다르다!!
[모자1, 모자2, 모자3]
, [상의1, 상의2, 상의3, 상의4]
이렇게 있다면 종류별로 입지 않는 경우를 1 추가해준다음 각 종류별 개수를 구한다.
여기에 '안입음, 안입음' 경우가 포함되어있으므로 1을 빼주면 끝!