전체 글76 [BAEKJOON] 9375 | 패션왕 신해빈 🔎 9375 | 패션왕 신해빈https://www.acmicpc.net/problem/9375💡 Solution옷들의 조합을 구하는 문제이므로 먼저 의상 종류 별로 의상의 수를 센다. 이 때 dictionary를 이용하였다.(의상의 수 + 안입는 경우의 수)를 의상의 종류 별로 곱해주고 알몸인 경우의 수를 하나 빼준다.def countClothingCombinations(n) : clothing = {} result = 1 for i in range(n) : clothing_name, clothing_type = input().split() if clothing_type in clothing : clothing[clothing.. 2024. 12. 19. [BAEKJOON] 1946 | 신입 사원 🔎 1946 | 시리얼 번호https://www.acmicpc.net/problem/1946💡 Solution먼저 서류 성적과 면접 성적을 모두 입력 받아 list화한다.서류 성적을 기준으로 정렬한다.본인보다 서류 성적이 좋은 사람들 중 가장 좋은 면접 성적보다 면접 성적이 좋으면 합격이다.이 때, 서류 성적이 1등인 사람은 절대 다른 지원자보다 모두 성적이 떨어질 수 없으므로 무조건 선발이다.import sysinput = sys.stdin.readlinedef find_passed_count(n) : count = 1 candidates = [] for i in range(n) : document_score, interview_score = map(int, input(.. 2024. 12. 19. [BAEKJOON] 14425 | 문자열 집합 🔎 14425 | 문자열 집합https://www.acmicpc.net/problem/14425💡 Solution집합에 포함되는 문자열을 세팅 후, 입력되는 문자열이 집합에 존재하는지 확인한다.n, m = map(int, input().split())str_set = set()result = 0for i in range(n) : str_set.add(input().rstrip()) for i in range(m) : if input().rstrip() in str_set : result += 1 print(result) 2024. 12. 19. [BAEKJOON] 1431 | 시리얼 번호 🔎 1431 | 시리얼 번호https://www.acmicpc.net/problem/1431💡 Solutionserial 번호의 길이 오름차순, serial 번호의 숫자 합 오름차순, serial 번호 사전 정렬 오름차순으로 정렬한다.def sumNum(serial) : return sum(int(ch) for ch in serial if ch.isdigit()) def key_function(serial) : return (len(serial), sumNum(serial), serial)n = int(input().rstrip())guitar = []for i in range(n) : guitar.append(input().rstrip()) guitar.sort(key=k.. 2024. 12. 18. 이전 1 2 3 4 ··· 19 다음