Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
232 B
14
Indexable
# ещё раз
n = int(input())
 
s = list(map(int, input().split()))
a = [s[-1]] * n
 
for p in range(n-1, 0, -1):
    an = s[p-1] - a[0]
    x = 2*p+1
    while x < n+1:
        an -= a[x-1]
        x += p
    a[p] = an
print(*a)