题目链接:http://codeforces.com/problemset/problem/712/A

题意:

  有两个序列 ai 和 bi, 长度都为 n, 对于序列 ai 满足 ai = bi - bi + 1 + bi + 2 - bi + 3 ...(i < n).现给你 ai, 让你求出 bi.

思路:

  ai = bi - bi + 1 + bi + 2 - bi + 3 ...(i < n).

  ai + 1 = bi + 1 - bi + 2 + bi + 3 ...  (i < n).

  对于上式相加就可以得到 ai + ai + 1 = bi.

代码:

 1 #include <bits/stdc++.h>
 2
 3 using namespace std;
 4 typedef long long LL;
 5
 6 const int MAXN = 100000;
 7 int a[MAXN + 3];
 8
 9 int main() {
10     //freopen("input", "r", stdin);
11     ios_base::sync_with_stdio(); cin.tie();
12     int n; cin >> n;
13     for(int i = 1; i <= n; i++) cin >> a[i];
14     for(int i = 1; i <= n; i++) cout << a[i] + a[i + 1] << (i == n ? "\n" : " ");
15     return 0;
16 }

转载于:https://www.cnblogs.com/Ash-ly/p/5861327.html

Codeforces 712A. 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. Codeforce 712A Memory and Crow

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

  3. codeforces A. Memory and Crow

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

  4. 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 ...

  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. Python 面向对象、封装
  2. 软件架构设计(第2版)——程序员向架构师转型必备
  3. 【白话机器学习】算法理论+实战之支持向量机(SVM)
  4. Baseline管理
  5. 解题报告 Toy Bricks
  6. redis持久化、内存优化、过期、LRU内存
  7. 服务器支持http tcp,Nginx配置http和tcp(示例代码)
  8. 记一次为公司搭建maven私服的过程
  9. STL中的lower_bound()函数和upper_bound()
  10. 2gt;MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _calloc 已经在 LIBCMTD.lib(dbgcalloc.obj) 中定义...
  11. 史上最全面“完美商业计划书”攻略和技巧(附PPT模板)
  12. 从SVN检出项目下载到本地后出现错误
  13. 各利不同网站的盈利模式
  14. java 毫秒数一天_java用毫秒数做日期计算的一个踩坑记录
  15. OSPF详解 一看就会奥!
  16. 三星schi779 android版本更新,SCH-I779
  17. RK3326 android10.0(Q) 系统精简瘦身
  18. iOS 文字动画,文字逐个显示
  19. AI人工智能自动化测试
  20. C/C++ 回调函数的使用

热门文章

  1. 如何用c++发出音乐
  2. 关于texlive2021安装,一直卡在安装界面怎么回事?
  3. Gerrit提交代码相关命令
  4. 失去优秀员工会付出惨痛的代价?
  5. 计算机操作员初级试题及答案,计算机操作员初级考试试题
  6. vTPM架构分析与环境部署
  7. ubuntu server 14.04 编译安装xen4.4.2配置vtpm(一)——xen4.4.2源码编译安装
  8. JZOJ5498. 【清华集训2017模拟12.10】大佬的难题
  9. DiskGenius安装教程
  10. 2022电大国家开放大学网上形考任务-桥梁工程技术非免费(非答案)