求大神教教我怎麼改
求大神教教我怎麼改
startAll, endAll = [], []quantity = int(input())while quantity != 0:start, end = map(int, input().split(" "))startAll.append(start)endAll.append(end)quantity -= 1
length = 0start = min(startAll)end = max(endAll)for block in range(start+1, end):for head, tail in zip(startAll, endAll):if block >= head and block <= tail:length += 1break
print(length)
改過後的soultion