폴더 분리
This commit is contained in:
29
workbook_8708/silver/25757-s5.py
Normal file
29
workbook_8708/silver/25757-s5.py
Normal file
@@ -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() 길이를 나누면 몫이 임스가 할 수 있는 게임 수이다.
|
||||
"""
|
||||
Reference in New Issue
Block a user