
[백준]18258번 큐 2 - 큐
·
SW개발/코딩테스트
import sys from collections import deque n = int(sys.stdin.readline()) queue = deque([]) for i in range(n): command = sys.stdin.readline().strip() if command.split()[0] == 'push': queue.append(command.split()[1]) elif command == 'pop': if len(queue) > 0 : print(queue.popleft()) else : print(-1) elif command == 'size': print(len(queue)) elif command == 'empty': if len(queue) == 0 : print(1) else ..