백준 7785. 회사에 있는 사람
·
백준
https://www.acmicpc.net/problem/7785import sysinput = sys.stdin.readlinen = int(input())log = {}for _ in range(n): name, state = input().split() if state == "enter": log[name] = True # 입장 기록 elif state == "leave": log.pop(name, None) # 퇴장 기록# 남아있는 사람들 출력 (역순으로 정렬)for name in sorted(log.keys(), reverse=True): print(name)
프로그래머스 42576. 완주하지 못한 선수
·
프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/42576 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krdef solution(participant, completion): answer = '' participant = sorted(participant) completion = sorted(completion) for i in range(len(completion)): if participant[i] != completion[i]: answer = participant[i] ..
프로그래머스 1845. 폰켓몬
·
프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/1845 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krdef solution(nums): new_nums = set(nums) answer = min(len(new_nums), len(nums) // 2) return answer
백준 15989. 1, 2, 3 더하기 4
·
백준
https://www.acmicpc.net/problem/15989import sysinput = sys.stdin.readlinet = int(input())dp = [1] * 10001 # 1만으로만 구성되는 경우는 모두 공통으로 1이므로 1로 초기화# dp[0] = 1인 이유는 아무것도 선택하지 않는 1가지 경우가 있기 때문.for i in range(2,10001): # 1만으로만 구성되는 경우에 +2씩 해주면 됨 dp[i] += dp[i-2]for i in range(3, 10001): # 1만으로만 구성되는 경우에 +3 해주면 됨 dp[i] += dp[i-3]for _ in range(t): n = int(input()) print(dp[n])
백준 19637. IF문 좀 대신 써줘
·
백준
https://www.acmicpc.net/problem/19637import sysinput = sys.stdin.readlinen, m = map(int, input().split()) # 칭호 개수, 캐릭터 개수styles = []# 칭호와 최대 전투력 입력for _ in range(n): style_name, style_maximum = input().split() styles.append((style_name, int(style_maximum)))for _ in range(m): power = int(input()) start, end = 0, n - 1 result = "" while start = power: result = styles[..
백준 3758. KCPC
·
백준
https://www.acmicpc.net/problem/3758import sysinput = sys.stdin.readlineT = int(input())for _ in range(T): n, k, t, m = map(int,input().split()) # 팀개수, 문제개수, 내팀아이디, 로그엔트리개수 ans = 0 # 내팀 순위 scores = [[0,0,0,i] for i in range(n+1)] # 최종점수, 풀이제출횟수, 마지막제출시간 problems = [[0]* (k+1) for _ in range(n+1)] for time in range(m): i, j, s = map(int,input().split()) # 팀아이디, 문제번호, 획득점수 ..