TMPCBAL @ 2024-08-06 03:24:19
程序在洛谷和pythonIDLE上都可以运行输出结果也一致,但是答题后提交测评无法通过,WA报错,求大佬解答一下
One = input()
One = list(map(int, One.split()))
Tree = '1' * (One[0] + 1)
for i in range(One[1]):
Size = input()
Size = list(map(int, Size.split()))
Tree = Tree[:Size[0]:1] + '0' * (Size[1] - Size[0]) + Tree[Size[1] + 1::1]
print(int(Tree.count('1')))
by UMS2 @ 2024-08-06 07:39:46
@TMPCBAL 0 区间的长度要加一,不然每次修改会少一个 0。
by TMPCBAL @ 2024-08-06 16:05:02
@UMS2 感谢大佬解答,问题已经解决啦