codeforces 712A. Memory and Crow
题目链接: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的更多相关文章
- CodeForces 712A Memory and Crow (水题)
题意:有一个序列,然后对每一个进行ai = bi - bi + 1 + bi + 2 - bi + 3.... 的操作,最后得到了a 序列,给定 a 序列,求原序列. 析:很容易看出来,bi = ai ...
- Codeforce 712A Memory and Crow
A. Memory and Crow time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
- codeforces 712A A. Memory and Crow(水题)
题目链接: A. Memory and Crow time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- 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 ...
- codeforces 712B. Memory and Trident
题目链接:http://codeforces.com/problemset/problem/712/B 题目大意: 给出一个字符串(由'U''D''L''R'),分别是向上.向下.向左.向右一个单位, ...
- Codeforces 712E Memory and Casinos
Description There are n casinos lined in a row. If Memory plays at casino \(i\), he has probability ...
- Codeforces 712C Memory and De-Evolution
Description Memory is now interested in the de-evolution of objects, specifically triangles. He star ...
- [CodeForces - 712D]Memory and Scores (DP 或者 生成函数)
题目大意: 两个人玩取数游戏,第一个人分数一开始是a,第二个分数一开始是b,接下来t轮,每轮两人都选择一个[-k,k]范围内的整数,加到自己的分数里,求有多少种情况使得t轮结束后a的分数比b高. ( ...
- CodeForces 712D Memory and Scores
$dp$,前缀和. 记$dp[i][j]$表示$i$轮结束之后,两人差值为$j$的方案数. 转移很容易想到,但是转移的复杂度是$O(2*k)$的,需要优化,观察一下可以发现可以用过前缀和来优化. 我把 ...
随机推荐
- C#元组示例详解
元组的概要: 数组合并了相同类型的对象,而元组合并了不同类型的对象.元组起源于函数编程语言(如F#) ,在这些语言中频繁使用元组.在N盯4中,元组可通过.NET Fmmework用于所有的NET语言. ...
- 2010-2014总结 ____V_V____ hello-world
.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table ...
- linux-查看系统是32位还是64位
可以用命令“getconf LONG_BIT”查看, 如果返回的结果是32则说明是32位,返回的结果是64则说明是64位. 此外还可以使用命令“uname -a”查看, 输出的结果中,如果有x86_6 ...
- java基础2.0:Object、Class、克隆、异常编程
Java编程中两个重要的类Object 和 Class及java异常编程 (1)是所有Java类(API提供的类.自定义类)的最终父类. (2)作用:在JVM管理对象中的过程中,有一套统一的类型检查和 ...
- jQuery调用WebService实现增删改查的实现
第一篇博客,发下我自己写的jQuery调用WebService实现增删改查的实现. 1 <!DOCTYPE html> 2 3 <html xmlns="http://ww ...
- js 对象 copy 对象
function clone(myObj) { if (typeof (myObj) != 'object') return myObj; if (myObj == null) return myOb ...
- C++强制类型转换操作符 static_cast
static_cast是一个强制类型转换操作符.强制类型转换,也称为显式转换,C++中强制类型转换操作符有static_cast.dynamic_cast.const_cast.reinterpert ...
- Mysql 中 iddata1的缩小步骤
原因就不多说了,,,, 直接上干货. 1. 备份数据库 mysqldump -q -uroot -ppassword --add-drop-table --all-databases >all1 ...
- UOJ244 【UER #7】短路
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...
- 未在本地计算机上注册"microsoft.ACE.oledb.12.0"提供程序解决办法
错误信息:未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序. 解决办法: 去http://download.microsoft.com/download/7/0/3/7 ...