Skip to content

Commit 1c5d22a

Browse files
committed
[BOJ] #9375. 패션왕 신해빈 / 실버3 / 45분(힌트)
1 parent fbfc70c commit 1c5d22a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
tc = int(input()) # 테스트 케이스의 수 입력
2+
for _ in range(tc):
3+
n = int(input()) # 의상의 수 입력
4+
clothes = {} # 의상 종류별로 의상을 저장할 사전
5+
for _ in range(n):
6+
cloth_name, cloth_type = map(str, input().split())
7+
if cloth_type in clothes:
8+
clothes[cloth_type].append(cloth_name)
9+
else:
10+
clothes[cloth_type] = [cloth_name]
11+
12+
# 각 의상 종류별로 선택할 수 있는 방법의 수 계산 (아무것도 선택하지 않는 경우 포함)
13+
combinations = 1
14+
for key in clothes:
15+
combinations *= (len(clothes[key]) + 1)
16+
17+
# 알몸 상태 제외 (모든 의상 종류에서 아무것도 선택하지 않는 경우)
18+
combinations -= 1
19+
20+
print(combinations) # 가능한 조합의 수 출력

0 commit comments

Comments
 (0)