문제링크: 의상
✍🏻 Information
| content | |
|---|---|
| 언어 | python |
| 난이도 | ⭐️⭐️ |
| 풀이시간 | 30분 |
| 제출횟수 | ∞ |
| 인터넷검색유무 | yes |
🍒 My Code
#from itertools import combinations
def solution(clothes):
answer = 1
cloth = {}
for i in clothes:
if i[1] not in cloth:
cloth[i[1]] = 1
else:
cloth[i[1]] += 1
for i in cloth.values():
answer*=(i+1)
"""
#처음에 풀이했던 나올 수 있는 조합 구해서 계산해주기
-> 1번 테케 시간초과 남
for n in range(1,len(cloth)+1):
l = list(combinations(cloth.values(),n))
for i in l:
tmp = 1
for j in i:
tmp*=j
answer+=tmp
"""
return answer-1
💡 What I learned