CF712A.Memory and Crow

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are nn integers b1,b2,...,bnb_{1},b_{2},...,b_{n} written in a row. For all ii from 11 to nn , values aia_{i} are defined by the crows performing the following procedure:

  • The crow sets aia_{i} initially 00 .
  • The crow then adds bib_{i} to aia_{i} , subtracts bi+1b_{i+1} , adds the bi+2b_{i+2} number, and so on until the nn '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,...,ana_{1},a_{2},...,a_{n} , and he now wants you to find the initial numbers b1,b2,...,bnb_{1},b_{2},...,b_{n} written in the row? Can you do it?

输入格式

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

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

输出格式

Print nn integers corresponding to the sequence b1,b2,...,bnb_{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 
    

说明/提示

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

In the second sample test, the sequence 11 , 3-3 , 44 , 1111 , 66 satisfies the reports. For example, 5=1165=11-6 and 6=66=6 .

首页