사용자 도구

사이트 도구


ps:problems:boj:9375

패션왕 신해빈

ps
링크acmicpc.net/…
출처BOJ
문제 번호9375
문제명패션왕 신해빈
레벨실버 3
분류

애드혹

시간복잡도O(t*n*l)
인풋사이즈t<=100, n<=30, l<=20
사용한 언어Python
제출기록32636KB / 124ms
최고기록52ms
해결날짜2021/07/26

풀이

  • 위장 과 동일한 문제. 설명은 그쪽을 참조.
    • 문제의 원 출처는 Benelux Algorithm Programming Contest 2013이다

코드

"""Solution code for "BOJ 9375. 패션왕 신해빈".

- Problem link: https://www.acmicpc.net/problem/9375
- Solution link: http://www.teferi.net/ps/problems/boj/9375
"""

import collections
import functools
import operator


def main():
    t = int(input())
    for _ in range(t):
        n = int(input())
        clothes = [input().split() for _ in range(n)]
        counter = collections.Counter(category for name, category in clothes)
        print(functools.reduce(operator.mul,
                               (v + 1 for v in counter.values()), 1) - 1)


if __name__ == '__main__':
    main()

토론

댓글을 입력하세요:
I T M Y U
 
ps/problems/boj/9375.txt · 마지막으로 수정됨: 2021/07/26 17:25 저자 teferi