A. Memory and Crow
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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

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

Memory gives you the values a1, a2, ..., an, and he now wants you to find the initial numbers b1, b2, ..., bn written in the row? Can you do it?

Input

The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of integers written in the row.

The next line contains n, the i'th of which is ai ( - 109 ≤ ai ≤ 109) — the value of the i'th number.

Output

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

Examples
input
5
6 -4 8 -2 3

output
2 4 6 1 3

input
5
3 -2 -1 5 6

output
1 -3 4 11 6

Note

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.

#include<cstdio>
#include<cstring>
const int maxn = 1e6 + 10;
int a[maxn];
int main()
{int n;while(~scanf("%d",&n)){for(int i = 0 ; i < n ; i++)scanf("%d",&a[i]);for(int i = 0 ; i < n-1 ; i++)printf("%d ",a[i] + a[i+1]);printf("%d\n",a[n-1]);}return 0;
}

codeforces A. Memory and Crow相关推荐

  1. Codeforces 712A Memory and Crow

    参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6374955.html [题目链接]  A. Memory and Crow time limit ...

  2. Codeforces 712A. Memory and Crow

    题目链接:http://codeforces.com/problemset/problem/712/A 题意: 有两个序列 ai 和 bi, 长度都为 n, 对于序列 ai 满足 ai = bi - ...

  3. Codeforces Round #370 (Div. 2) A. Memory and Crow 水题

    A. Memory and Crow 题目连接: http://codeforces.com/contest/712/problem/A Description There are n integer ...

  4. Codeforce 712A Memory and Crow

    A. Memory and Crow time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...

  5. Memory and Crow(CodeForces 712A)

    题目描述: There are n integers b1, b2, -, bn written in a row. For all i from 1 to n, values ai are defi ...

  6. Memory and Crow

    Description There are n integers b1, b2, -, bn written in a row. For all i from 1 to n, values ai ar ...

  7. Codeforces 712C. Memory and De-Evolution

    题目链接:http://codeforces.com/problemset/problem/712/C 题意: 给你两个值 a 和 b (a > b), 代表这里有两个等边三角形, 边长分别为 ...

  8. Codeforces 712E Memory and Casinos

    Description There are n casinos lined in a row. If Memory plays at casino \(i\), he has probability ...

  9. codeforces 712 Memory and De-Evolution

    2019-05-19 13:25:37 加油,加油,坚持,坚持!!! 一定要逆推,才可以是最少的次数 更好的方法: https://www.cnblogs.com/ECJTUACM-873284962 ...

最新文章

  1. Blender三维建筑场景动画制作学习教程
  2. Java自带的线程池Executors.newFixedThreadPool
  3. C语言插入排序(解析)
  4. 18款帝豪gl车机升级_好看又实用的2018款帝豪GL分享,感受它的魅力
  5. Go的sync.WaitGroup(二):WaitGroup让主程序与协程全部都执行 并且全部执行完成
  6. mysql之 slow log 慢查询日志
  7. yum方式安装mysql多实例_centos7下使用yum安装mysql
  8. Web前端笔记(1)
  9. AsnycTask的内部的实现机制
  10. 8.RabbitMQ实战 --- 从Web端管理RabbitMQ
  11. 线性反馈移位寄存器实现产生伪随机数M序列
  12. 论文绘图-教你如何绘制响应面
  13. 现代优化算法 (二): 遗传算法 及应用举例
  14. 仿ios相机apk_iCamera摄像头下载|iCamera仿苹果相机安卓版v4.0下载 _当游网
  15. matlab如何求反渐开线函数,inv函数(inv函数查询表)
  16. Centos7 jdk8,Tomcat9的安装与配置
  17. 《社交困境》:算法抓住了人类的弱点……
  18. 插入排序原理及实现思路
  19. 大数据技术与应用实训心得_数据实习心得
  20. zzuli:1102火车票退票费计算(函数专题)

热门文章

  1. 工业数字化转型 — 数字化工厂的信息化系统架构
  2. VisionMobile:2012年移动开发者经济报告(一):关键内容
  3. AXURE9原型教程:做跑马灯广告、弹幕
  4. Java集合类学习UML图——ArrayList
  5. java订单编号工具类_[idmiss-common] Java 工具类之- 顺序订单号的生成
  6. 电信物联网DMP平台部相关知识日志(此文章将总结客户常遇故障及解决办法)
  7. 阿拉伯数字金额转中文大写金额 base C++
  8. 机器学习系列--贝叶斯分类算法
  9. Python爬虫入门教程 21-100 云课堂课程数据挖掘
  10. darkNet配置问题