python3-python小白,20分,还能怎么做啊?

P1047 [NOIP2005 普及组] 校门外的树

lyj1150428217 @ 2022-08-15 15:42:37

if name == 'main': whole = input().split(' ')

lis = []
for i in range(int(whole[1])):
    lis.append(input().split(' '))

tree = []
for i in range(int(whole[0])+1):
    tree.append(i)

for li in lis:
    for l in range(int(li[0]),int(li[1])+1):
        if l in tree:
            tree.remove(l)
        else:
            continue
print(len(tree))

|