python RE0分 求助(样例是对的)

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

Ifuncube7 @ 2023-02-19 17:32:44

s = input()
s = s.split()
b = int(s[0])
f = int(s[1])
k = 1
su = 0
a = []
for i in range(999):
    a.append(0)
for i in range(f):
    k += 1
    c = int(s[k])
    k += 1
    d = int(s[k])
    for j in range(c,d+1):
        a[j] = 1
for i in range(b+1):
    if a[i] == 0:
        su += 1
print(su)

by 细数繁星 @ 2023-04-05 10:20:55

建议用C++,Python RE不少见了。


|