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. 压力测试工具ab 及 centos下单独安装方法
  2. 在编译内核时出现uudecode错误
  3. 2.1 数个常用的网络命令
  4. 一致 先验分布 后验分布_分布式事务常见解决方案与最终一致性
  5. SQL Server 和 Oracle 以及 MySQL 有哪些区别?
  6. html兄弟选择器怎么用,兄弟选择器 - 选择后面相邻的所有兄弟元素 - css3普通选择器...
  7. python datetime 加一个月_Python日期的加减等操作的示例
  8. .NET程序员面试指南:解释委托的基本原理
  9. MySQL 性能方案
  10. opta球员大数据预测胜负_大数据预测4个特征,10个典型行业
  11. 郝斌c语言课程笔记,郝斌C语言详细笔记(附源码) - 图文
  12. 微信小程序点击事件传递自定义参数的方法和跨页面传递数据
  13. 极域课堂管理系统软件如何取消控制_智慧物流自动化智能仓储管理架构分析
  14. 局域网内连接其他计算机共享的打印机
  15. flutter_interview面试题和答案(2022)
  16. 03筑基期——循环、嵌套循环、循环跳转、随机数(算法基础又篇)
  17. PCBA上电容开裂短路,怎么又是设计的错?
  18. matlab绘图 作业,实验作业2 - -MATLAB作图
  19. MySQL插入表格数据的时候出现1265错误
  20. 毕业论文封面中图分类号和UDC查询

热门文章

  1. 什么是微服务?架构的演变过程
  2. 美女学妹问我,考研还是做个互联网打工人?
  3. Jedis无法连接Redis的解决办法
  4. Xposed模块开发入门-最基本的项目创建
  5. 计算机编程课程英语单词,计算机编程常用英语单词
  6. chrome怎样编辑html页面大小,使用Chrome DevTools实时编辑HTML和CSS
  7. 国内外常用大型经典论坛
  8. Unity3d将vs关联起来/unity3d设置默认脚本编辑器
  9. 物联卡流量池搭建,搭建企业物联卡流量池省力省钱不停机!
  10. 如何给电脑文件加密?分享四种方法!