B - Inverse Prefix Sum(Atcoder)

Hyoungtak (Alvin) Cha·2023년 1월 4일
0

PS: I first got the data in n and s.
Then, I just subtracted every element of s from their respective previous elements and put them in a. Lastly, I printed them out in the format provided.

n = int(input())
s = list(map(int, input().split()))
prev = s[0]
a = [prev]

for i in range(1,n):
    prev = s[i-1]
    a.append(s[i] - prev)
for aa in a:
    print(aa, end = ' ')

0개의 댓글