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

题目大意:

  给你一个数字系列,求其满足条件的一个序列。

  条件为:

    ai = bi - bi + 1 + bi + 2 - bi + 3....

解题思路:

    可先从后向前推,b[n]=a[n](1-n个数);

    b[i]=a[i]+b[i+1]-b[i+1]...

    然而,你可以发现b[i]=a[i]+a[i+1],一个a数组即可解决问题。

AC Code:

【切记暴力不好使,还是泪奔0.0,最近感觉智商被掏空】

 #include<bits/stdc++.h>
using namespace std;
int a[];
int main()
{
int n,i;
while(scanf("%d",&n)!=EOF)
{
for(i=; i<=n; i++)
scanf("%d",&a[i]);
for(i=; i<n; i++)
{
printf("%d ",a[i]+a[i+]);
}
printf("%d\n",a[i]);
}
return ;
}

codeforces 712A. Memory and Crow的更多相关文章

  1. CodeForces 712A Memory and Crow (水题)

    题意:有一个序列,然后对每一个进行ai = bi - bi + 1 + bi + 2 - bi + 3.... 的操作,最后得到了a 序列,给定 a 序列,求原序列. 析:很容易看出来,bi = ai ...

  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 712A A. Memory and Crow(水题)

    题目链接: A. Memory and Crow time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  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. codeforces 712B. Memory and Trident

    题目链接:http://codeforces.com/problemset/problem/712/B 题目大意: 给出一个字符串(由'U''D''L''R'),分别是向上.向下.向左.向右一个单位, ...

  6. Codeforces 712E Memory and Casinos

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

  7. Codeforces 712C Memory and De-Evolution

    Description Memory is now interested in the de-evolution of objects, specifically triangles. He star ...

  8. [CodeForces - 712D]Memory and Scores (DP 或者 生成函数)

    题目大意: 两个人玩取数游戏,第一个人分数一开始是a,第二个分数一开始是b,接下来t轮,每轮两人都选择一个[-k,k]范围内的整数,加到自己的分数里,求有多少种情况使得t轮结束后a的分数比b高.  ( ...

  9. CodeForces 712D Memory and Scores

    $dp$,前缀和. 记$dp[i][j]$表示$i$轮结束之后,两人差值为$j$的方案数. 转移很容易想到,但是转移的复杂度是$O(2*k)$的,需要优化,观察一下可以发现可以用过前缀和来优化. 我把 ...

随机推荐

  1. ThinkPHP上传返回 “文件上传保存错误!”

    这个问题,最终的由于 Local.class.php中的iconv('utf-8', 'gb2312' ,$filename)的问题 因为我上传的文件名中有 "-" 这个符号. i ...

  2. 深入 理解vxlan

    VXLAN RFC 文档 : https://tools.ietf.org/html/rfc7348 作为网络虚拟化的重要技术,VXLAN备受关注,该协议是如何运作的?如何通过数据与控制层面的分离实现 ...

  3. Qt学习中遇到的问题

    问题: 一个Qt小项目,编译成功并成功运行,但应用程序输出中出现如下异常:FTH: (9892): *** Fault tolerant heap shim applied to current pr ...

  4. PHP输出一个指定范围内的随机数

    <?php echo mt_rand(5, 15); ?>

  5. codeforces Hill Number 数位dp

    http://www.codeforces.com/gym/100827/attachments Hill Number Time Limits:  5000 MS   Memory Limits: ...

  6. 系统间通信(3)——IO通信模型和JAVA实践 上篇

    来源:http://blog.csdn.net/yinwenjie 1.全文提要 系统间通信本来是一个很大的概念,我们首先重通信模型开始讲解.在理解了四种通信模型的工作特点和区别后,对于我们后文介绍搭 ...

  7. 理解 Java 的三大特性之多态

    面向对象编程有三大特性:封装.继承.多态. 封装隐藏了类的内部实现机制,可以在不影响使用的情况下改变类的内部结构,同时也保护了数据.对外界而已它的内部细节是隐藏的,暴露给外界的只是它的访问方法. 继承 ...

  8. ASP.NET MVC html help

    public static class HtmlHelper { /// <summary> /// 返回没有边框的只读的TextBox标签 /// </summary> // ...

  9. C++实现类似飞鸽的内网聊天工具,采用多播的协议实现

    项目相关地址 源码:https://github.com/easonjim/FreeAnt bug提交:https://github.com/easonjim/FreeAnt/issues

  10. NuGet命令行工具和可视化工具

    Nuget出了命令行工具之外,还有一个可视化工具,下载地址如下: 命令行(推荐官网下载,有中文提示!):https://dist.nuget.org/index.html 可视化(简单.方便.易用): ...