题解 | 【模板】队列操作
【模板】队列操作
https://www.nowcoder.com/practice/1137c8f6ffac4d5d94cc1b0cb08723f9
n = int(input().strip()) queue = [] for _ in range(n): num = list(map(int,input().strip().split(" "))) if num[0] == 1: queue.append(num[1]) elif num[0] == 2: if len(queue) == 0: print("ERR_CANNOT_POP") else: queue.pop(0) elif num[0] == 3: if queue: print(queue[0]) else: print("ERR_CANNOT_QUERY") elif num[0] == 4: print(len(queue))