HUFS/HUFS 모각코 캠프
[모각코] 220806 Today I Learned
leta
2022. 8. 6. 13:10
<백준 9375번 - 패션왕 신해빈>
문제만 봤을 때는 금방 풀 수 있을 것 같았는데 전체적인 로직 파악을 제대로 하지 못해 꽤 오랜 시간이 걸린 문제였다.
테스트 케이스를 통과시키기 급급해하며 문제를 푸는 것보다 그 테케를 이용하여 전반적인 로직을 찾는 연습을 해야겠다.
import sys
input = sys.stdin.readline
t = int(input()) #test case 개수
for i in range(t):
n = int(input()) #의상 수
clothes = {}
for j in range(n):
c_n, c_t = input().split() #clothes_name, clothes_type
#종류별로 분류
if c_t not in clothes.keys():
clothes[c_t] = 1
else:
clothes[c_t] += 1
ans = 1
for i in clothes: #i: key
ans *= (clothes[i]+1) #해당 종류는 안 입는 경우 포함
print(ans-1) #알몸인 경우 제외
자세한 풀이는 아래 링크의 게시물에서 작성하였다.
2022.08.06 - [Coding/백준] - [Python] 백준 9375번 - 패션왕 신해빈
[Python] 백준 9375번 - 패션왕 신해빈
문제 https://www.acmicpc.net/problem/9375 9375번: 패션왕 신해빈 첫 번째 테스트 케이스는 headgear에 해당하는 의상이 hat, turban이며 eyewear에 해당하는 의상이 sunglasses이므로 (hat), (turban), (sungla..
letalearns.tistory.com