Python,这样为啥不可以啊?

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

cookoer @ 2022-09-26 11:32:54

l,m=map(int,input('').split())

a=[]

b=[]

c=[]

for i in range(l):

c.append('*')

for i in range(m):

a.append('*')
b.append('*')

for i in range(m):

a[i],b[i]=map(int,input().split())

for i in range(len(a)):

for f in range(a[i],b[i]):
    c[f]='p'

h=0

for i in range(len(c)):

if c[i]=='*':
     h+=1

print(h-1)


by a2lyaXNhbWUgbWFyaXNh @ 2022-09-26 11:38:22

MARKDOWN炸了


|