---
# System prepended metadata

title: e339. 前綴和練習

---

## 題目連結[e339](https://zerojudge.tw/ShowProblem?problemid=e339)
這題的解法就是利用前綴和，b[i] = b[i-1] + a[i]。
```python=
n = int(input())
a = list(map(int,input().split()))
b = [0]*2000000
for i in range(n):
    if i == 0:
        b[i] = a[i]
    else:
        b[i] = b[i-1] + a[i]
for i in range(n):
    print(b[i],end= " ")
```