python代码求助!
查看原帖
python代码求助!
1381041
Jack1024楼主2024/7/6 12:16
f = int(input())
for i in range(f):
    a = int(input())
    sta = []
    for j in range(a):
        ie = input()
        if 'push' in ie:
            sta.append(int(ie[-1]))
        elif ie == 'pop':
            if len(sta)==0:
                print('Empty')
            else:
                sta.pop()
        elif ie == 'query':
            if len(sta)==0:
                print('Anguei!')
            else:
                print(sta[-1])
        elif ie == 'size':
            print(len(sta))

结果是--RE--TLE--WA-- 希望哪位大佬赐教一下

2024/7/6 12:16
加载中...