python 全WA,样例没问题
查看原帖
python 全WA,样例没问题
788457
lolaFENG楼主2022/9/24 22:26
num = int(input())
d = {}
result = []
for i in range(num):
    a, *b = map(str,input().split(' '))
    a = int(a)
    # print(a,b)
    if a == 1:
        d2 = {b[0]:b[1]}
        # print(d2)
        d.update(d2)
        # print(d)
        output = 'OK'
        result.append(output)
    elif a == 2:
        if b[0] in d.keys():
            output = d[b[0]]
            result.append(output)
        else:
            output = 'Not found'
            result.append(output)
    elif a == 3:
        if b[0] in d.keys():
            del d[b[0]]
            output = 'Deleted successfully'
            result.append(output)
        else:
            output = 'Not found'
            result.append(output)
    elif a == 4:
        output = str(len(d))
        result.append(output)
m = '\n'.join(result)
print(m)
2022/9/24 22:26
加载中...