https://www.acmicpc.net/problem/7785
7785번: 회사에 있는 사람
첫째 줄에 로그에 기록된 출입 기록의 수 n이 주어진다. (2 ≤ n ≤ 106) 다음 n개의 줄에는 출입 기록이 순서대로 주어지며, 각 사람의 이름이 주어지고 "enter"나 "leave"가 주어진다. "enter"인 경우는
www.acmicpc.net
import sys
hash = {}
num = int(sys.stdin.readline())
for _ in range(num):
name, situation = map(str, sys.stdin.readline().split())
if situation == 'leave':
del hash[name]
else:
hash[name] = situation
re = sorted(hash.keys(), reverse=True)
for key in re:
print(key)
https://www.acmicpc.net/problem/1351
1351번: 무한 수열
첫째 줄에 3개의 정수 N, P, Q가 주어진다.
www.acmicpc.net
import sys
from collections import defaultdict
def find_num(n):
if hash[n] != 0:
return hash[n]
else:
hash[n] = find_num(n//P) + find_num(n//Q)
return hash[n]
N,Q,P = map(int, sys.stdin.readline().split())
hash = defaultdict(int)
hash[0] = 1
print(find_num(N))
https://www.acmicpc.net/problem/1620
1620번: 나는야 포켓몬 마스터 이다솜
첫째 줄에는 도감에 수록되어 있는 포켓몬의 개수 N이랑 내가 맞춰야 하는 문제의 개수 M이 주어져. N과 M은 1보다 크거나 같고, 100,000보다 작거나 같은 자연수인데, 자연수가 뭔지는 알지? 모르면
www.acmicpc.net
import sys
epoch, q = map(int, sys.stdin.readline().split())
re = {}
for i in range(epoch):
name = sys.stdin.readline()
re[i+1] = name[:-1]
rever = {v:k for k,v in re.items()}
for i in range(q):
an = sys.stdin.readline()
if 48 <= ord(an[0]) <= 57:
print(re[int(an)])
else:
print(rever[str(an[:-1])])
'2023 하계 모각코 > 개인용' 카테고리의 다른 글
뿅뿅망치 팀 2023 하계 모각코 활동5 (0) | 2023.08.16 |
---|---|
뿅뿅망치 팀 2023 하계 모각코 활동4 (0) | 2023.08.15 |
뿅뿅망치 팀 2023 하계 모각코 활동 3 (3) | 2023.08.04 |
뿅뿅망치 팀 2023 하계 모각코 활동 2 (0) | 2023.07.31 |
뿅뿅망치 팀 2023 하계 모각코 활동 1 (2) | 2023.07.14 |