Beakjoon&프로그래머스/파이썬
[백준/파이썬] 21280번 Förvirrad föreläsare
현장
2025. 3. 7. 15:18
-Code
n = int(input())
arr = list(map(int, input().split()))
now = arr[0]
res = [0, 0]
for el in arr[1:]:
if now > el:
res[0] += now - el
elif now < el:
res[1] += el - now
now = el
print(*res)