求助,这样写为什么只有70分

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

bucking_conion @ 2024-11-03 22:18:21

a = input().split()
c = set()
total = list(range(int(a[0])))
for i in range(int(a[1])):
    b = input().split()
    c.update(list(range(int(b[0]),int(b[1])+1)))
for shan in c:
    total.remove(shan)
count = 0
for y in total:
    count+=1
print(count+1)

by Dave123 @ 2024-11-24 19:46:54

AC代码(勿喷)

uis = input().split("")
s = set()
for i in range(0, uis[1]):
    tmp = input().split("")
    for j in range(tmp[0], tmp[1] + 1):
        set.add(j)
print(uis[0] + 1 - len(set))

|