From 9bdbaec471245e7953f266de2f8a6260e37b7a1e Mon Sep 17 00:00:00 2001 From: sm4640 Date: Wed, 21 Jan 2026 20:43:13 +0900 Subject: [PATCH] =?UTF-8?q?25757-s5=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workbook_8708/25757-s5.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 workbook_8708/25757-s5.py diff --git a/workbook_8708/25757-s5.py b/workbook_8708/25757-s5.py new file mode 100644 index 0000000..e0cb49f --- /dev/null +++ b/workbook_8708/25757-s5.py @@ -0,0 +1,29 @@ +# 임스와 함께하는 미니게임 + +import sys + +input = sys.stdin.readline + +game_types = {"Y": 2, "F": 3, "O": 4} + +def solution(): + q = list(input().rstrip().split()) + n, personnel = int(q[0]), game_types.get(q[1], 0) + people = set() + for _ in range(n): + people.add(input().rstrip()) + result = len(people) // (personnel-1) + print(result) + return + + +solution() + +""" +걸린 시간: 18분 + +시간 복잡도: 사람들 이름을 쭉 읽고, 쓰고, set() 개수 세는 것까지 n이므로 전체 시간복잡도는 O(n) + +해설: 한 사람이 임스와 두 번 게임을 할 수는 없으므로 참여 명단을 중복을 제거하는 set()을 활용한다. +그 후 임스 본인을 제외한 게임에 필요한 인원 수로 set() 길이를 나누면 몫이 임스가 할 수 있는 게임 수이다. +""" \ No newline at end of file