#P712A. Memory and Crow

Memory and Crow

Memory and Crow

题面翻译

nn个数b1,b2,...,bnb_1,b_2,...,b_n

a1,a2,...,ana_1,a_2,...,a_n是通过等式aia_i = bibi+1+bi+2bi+3....(±)bnb_i-b_{i+1}+b_{i+2}-b_{i+3}....(±)b_n得到的

现给你a1,a2,...,ana_1,a_2,...,a_n这n个数,问b1,b2,...,bnb_1,b_2,...,b_n是多少

Translated by @@AC我最萌

题目描述

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

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

Memory gives you the values a1,a2,...,an a_{1},a_{2},...,a_{n} , and he now wants you to find the initial numbers b1,b2,...,bn 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 n ( 2<=n<=100000 2<=n<=100000 ) — the number of integers written in the row.

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

输出格式

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

样例 #1

样例输入 #1

5
6 -4 8 -2 3

样例输出 #1

2 4 6 1 3

样例 #2

样例输入 #2

5
3 -2 -1 5 6

样例输出 #2

1 -3 4 11 6

提示

In the first sample test, the crows report the numbers 6 6 , 4 -4 , 8 8 , 2 -2 , and 3 3 when he starts at indices 1 1 , 2 2 , 3 3 , 4 4 and 5 5 respectively. It is easy to check that the sequence 2 2 4 4 6 6 1 1 3 3 satisfies the reports. For example, 6=24+61+3 6=2-4+6-1+3 , and 4=46+13 -4=4-6+1-3 .

In the second sample test, the sequence 1 1 , 3 -3 , 4 4 , 11 11 , 6 6 satisfies the reports. For example, 5=116 5=11-6 and 6=6 6=6 .