분류 전체보기73 [백준 18258] 큐 2 - Python(파이썬) from collections import deque import sys N = int(sys.stdin.readline().strip()) my_deq = deque() for _ in range(N): order = list(map(str, sys.stdin.readline().split())) if order[0] == 'push': my_deq.append(order[1]) elif order[0] == 'pop': print(my_deq.popleft() if my_deq else -1) elif order[0] == 'size': print(len(my_deq)) elif order[0] == 'empty': print(0 if my_deq else 1) elif order[0] == 'fro.. 2021. 2. 15. 이전 1 ··· 10 11 12 13 다음