经测试,pop,del,remove性能差不多,切片较低
class Queue(): def __init__(self): self.queue = [] def add(self, value): self.queue.append(value) def poll(self): self.queue.pop(0) def peek(self): return self.queue[0] q = Queue() n = int(input()) for _ in range(n): l = input().split() if l[0] == 'add': q.add(int(l[1])) elif l[0] == 'poll': q.poll() elif l[0] == 'peek': print(q.peek())