303683: CF712A. Memory and Crow

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Memory and Crow

题意翻译

有$n$个数$b_1,b_2,...,b_n$ $a_1,a_2,...,a_n$是通过等式$a_i$ = $b_i-b_{i+1}+b_{i+2}-b_{i+3}....(±)b_n$得到的 现给你$a_1,a_2,...,a_n$这n个数,问$b_1,b_2,...,b_n$是多少 Translated by @@AC我最萌

题目描述

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 

说明

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

Input

题意翻译

有$n$个数$b_1,b_2,...,b_n$ $a_1,a_2,...,a_n$是通过等式$a_i$ = $b_i-b_{i+1}+b_{i+2}-b_{i+3}....(±)b_n$得到的 现给你$a_1,a_2,...,a_n$这n个数,问$b_1,b_2,...,b_n$是多少 Translated by @@AC我最萌

加入题单

上一题 下一题 算法标签: