题目链接: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. 线性表的顺序存储结构C语言版

    #include <stdio.h> #define MAXSIZE 101 #define N 10 typedef struct SeqList { int data[MAXSIZE] ...

  2. 三大范式与BCNF

    引用:http://www.cnblogs.com/ybwang/archive/2010/06/04/1751279.html 参考: 1.范式间的区别 http://www.cnblogs.com ...

  3. MySQL的恢复脚本

    原文转自: http://blog.csdn.net/dbanote/article/details/13295727 应用场景: ********************************** ...

  4. iOS开发小技巧--获取自定义的BarButtonItem中的自定义View的方法(customView)

    如果BarButtonItem是通过[[UIBarButtonItem alloc] initWithCustomView:(nonnull UIView *)]方法设置的.某些情况下需要修改BarB ...

  5. 线段树 poj3225

    U:把区间[l,r]覆盖成1I:把[-∞,l)(r,∞]覆盖成0    D:把区间[l,r]覆盖成0C:把[-∞,l)(r,∞]覆盖成0 , 且[l,r]区间0/1互换S:[l,r]区间0/1互换 因 ...

  6. zoj1492 最大团

    Maximum Clique Time Limit: 10 Seconds      Memory Limit: 32768 KB Given a graph G(V, E), a clique is ...

  7. linux 下远程连接windows

    安装软件 sudo apt-get install rdesktop 连接windows 然后进入windows登陆界面 输入应户名密码后就进入windows了 注意的是 参数-f是全屏的意思  然后 ...

  8. 工具软件发现(编写chm 文件的工具)

    编写chm 文件的工具 1.PrecisionHelper 安装之后,发现 编写的很不方便,直接在html 上编写-- 不好用 2.Winchm (推荐) 很好用,赞!至少对比了上面那个复杂的操作之后 ...

  9. json:There is a cycle in the hierarchy!

    在使用JSONObject.fromObject的时候,出现“There is a cycle in the hierarchy”异常. 意思是出现了死循环,也就是Model之间有循环包含关系: 解决 ...

  10. JQuery触发radio或checkbox的change事件

    在JQuery中,当给radio或checkbox添加一个change事件时,如果它的值发生变化就会触发change事件;本文将详细介绍如何利用JQuery触发Checkbox的change事件需要了 ...