空调
差分:
N = int(input())
p = list(map(int, input().split()))
t = list(map(int, input().split()))
d,s=[0]*100010,[0]*100010
for i in range(N):
d[i] = p[i]-t[i]
for i in range(N):
s[i] += d[i]
s[i+1] -= d[i]
ans = 0
for i in range(N+1):
if s[i]>0:
ans += s[i]
print(ans)
标签:map,int,list,空调,range,ans,input,刷题,AcWing
From: https://blog.csdn.net/ofsurvival/article/details/137157568