← Back to List

8659번: Samochody ↗

Solutions

Python 3
137 B | 137 chars
n = int(input())
l = [*map(int, input().split())]
s = sum(l)
ans = 0

for i in l:
  if i == 0:
    ans += s
  else:
    s -= 1
print(ans)