Beakjoon&프로그래머스/파이썬

[백준/파이썬] 27222번 Штангист

현장 2025. 2. 16. 15:33

-Code

n = int(input())
n_list = list(map(int, input().split()))
res = 0

for i in range(n):
    x, y = map(int, input().split())

    if n_list[i]:
        res += y - x if y - x > 0 else 0

print(res)