洛谷——P1047 校门外的树 python实现
l, m = map(int, input().split(' '))
trees = [True]*(l+1)
for i in range(m):
start, end = map(int, input().split(' '))
trees[start:end+1] = [False]*(end+1-start)
print(sum(trees))
洛谷——P1047 校门外的树 python实现
l, m = map(int, input().split(' '))
trees = [True]*(l+1)
for i in range(m):
start, end = map(int, input().split(' '))
trees[start:end+1] = [False]*(end+1-start)
print(sum(trees))