题解 | 校门外的树
校门外的树
https://www.nowcoder.com/practice/0e8cfc82936048769af45967f3c4ef7e
L,M=map(int,input().split())
Tree=[1]*(L+1)#长度为L,1为种满了树
cun=0
for i in range(M):
l,r=map(int,input().split())
for j in range(l,r+1):
Tree[j]=0
for i in range(len(Tree)):
if Tree[i]==1:
cun+=1
print(cun)
