题库练习 Memory and Crow
← 上一题 下一题 →

A10480 | Memory and Crow

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

There are $n$ integers $b_{1},b_{2},...,b_{n}$ written in a row. For all $i$ from $1$ to $n$ , values $a_{i}$ are defined by the crows performing the following procedure:

- The crow sets $a_{i}$ initially $0$ .
- The crow then adds $b_{i}$ to $a_{i}$ , subtracts $b_{i+1}$ , adds the $b_{i+2}$ number, and so on until the $n$ 'th number. Thus, $a_{i}=b_{i}-b_{i+1}+b_{i+2}-b_{i+3}...$ .

Memory gives you the values $a_{1},a_{2},...,a_{n}$ , and he now wants you to find the initial numbers $b_{1},b_{2},...,b_{n}$ written in the row? Can you do it?

输入格式

The first line of the input contains a single integer $n$ ( $2<=n<=100000$ ) — the number of integers written in the row.

The next line contains $n$ , the $i$ 'th of which is $a_{i}$ ( $-10^{9}<=a_{i}<=10^{9}$ ) — the value of the $i$ 'th number.

输出格式

Print $n$ integers corresponding to the sequence $b_{1},b_{2},...,b_{n}$ . It's guaranteed that the answer is unique and fits in 32-bit integer type.

输入输出样例

输入 #1
5
6 -4 8 -2 3
输出 #1
2 4 6 1 3 
输入 #2
5
3 -2 -1 5 6
输出 #2
1 -3 4 11 6 
C++ 编辑器
输入
输出