题解 | #【模板】循环队列#
【模板】循环队列
https://www.nowcoder.com/practice/0a3a216e50004d8bb5da43ad38bcfcbf
def push(queue: list, que_len: int, x: int): if len(queue) >= que_len: print('full') else: queue.append(x) def front(queue: list): if len(queue) == 0: print('empty') else: print(queue[0]) def pop(queue: list): if len(queue) == 0: print('empty') else: print(queue.pop(0)) que_len, op_count = list(map(int, input().strip().split())) n = 0 queue = [] while n < op_count: op_list = input().strip().split() if len(op_list) == 2: push(queue, que_len, int(op_list[1])) else: if op_list[0] == 'front': front(queue) else: pop(queue) n += 1