2019-05-18

08:48:27

加油,加油,坚持!!!

这道题我没有想出公式推导,只是按照模拟题来做,第5个样例超时

样例超时,方法错误

https://www.cnblogs.com/ECJTUACM-873284962/p/6375011.html

AC代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_n = 1e5 + ;
ll a[max_n];
ll b[max_n]; int main()
{
ll n;
ll i, j;
scanf("%lld", &n);
for(i = ; i < n; i++)
{
scanf("%lld", &a[i]);
}
for(i = ; i < n - ; i++)
{
b[i] = a[i] + a[i + ];
cout << b[i] << " ";
}
b[n - ] = a[n - ];
cout << b[n - ] ;
return ;
}

我的代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_n = 1e5 + ;
ll a[max_n];
ll b[max_n]; int main()
{
ll n;
ll i, j; scanf("%lld", &n);
for (i = ; i <= n; i++)
{
scanf("%lld", &a[i]);
}
b[n] = a[n];
//超时
for (i = n - ; i >= ; i--)
{
ll count = ;
ll m = ;
for (j = i + ; j <= n; j++)
{
count = count + (m * b[j]);
m = m * -;
}
b[i] = a[i] + count; }
for (i = ; i <= n; i++)
{
if (i == n)
{
cout << b[i];
}
else
{
cout << b[i] << " ";
}
} return ;
}

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

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

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

  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 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. 《Linux内核精髓:精通Linux内核必会的75个绝技》一HACK #12 使用Memory Cgroup限制内存使用量

    HACK #12 使用Memory Cgroup限制内存使用量 Memory Cgroup是Cgroup的资源限制功能之一,可以控制特定进程可以使用的内存量.Memory CgroupMemory C ...

  5. 3.1 全局存储带宽与合并访问 -- Global Memory(DRAM) bandwidth and memory coalesce

    全局存储带宽(DRAM) 全局内存是动态随机访问的方式访问内存.我们希望访问DRAM的时候非常快,实际情况是DRAM中出来的数据非常非常慢,这就好比,理想状态是泄洪,水倾巢而出,气势宏伟,实际取水却像 ...

  6. codeforces 712A. Memory and Crow

    题目链接:http://codeforces.com/problemset/problem/712/A 题目大意: 给你一个数字系列,求其满足条件的一个序列. 条件为: ai = bi - bi +  ...

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

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

  8. Codeforces Round #370 (Div. 2)B. Memory and Trident

    地址:http://codeforces.com/problemset/problem/712/B 题目: B. Memory and Trident time limit per test 2 se ...

  9. Android内存管理(4)*官方教程 含「高效内存的16条策略」 Managing Your App's Memory

    Managing Your App's Memory In this document How Android Manages Memory Sharing Memory Allocating and ...

随机推荐

  1. OpenCV:使用 随机森林与GBDT

    随机森林顾名思义,是用随机的方式建立一个森林.简单来说,随机森林就是由多棵CART(Classification And Regression Tree)构成的.对于每棵树,它们使用的训练集是从总的训 ...

  2. SQL基本概述

    DBMS的种类: 层次数据库HDB 面向对象数据库OODB XML数据库XMLDB 键值存储系统KVS 关系数据库RDB RDBMS(关系数据库管理系统),主要5有种: Oracle Database ...

  3. 解析MYsql写的表达式

    今天遇到个问题,Sql中直接写的是复杂表达式,如何解析呢? round(((0.00579049505+0.00006600324*JING_JIE^2*SHU_GAO-0.00000046921*J ...

  4. 查看表之间的关系 需要在eas中的商业分析-扩展报表中心-报表平台下的语义层方案管理

    查看表之间的关系 需要在eas中的商业分析-扩展报表中心-报表平台下的语义层方案管理

  5. 【剑指Offer】41、和为S的连续正数序列

      题目描述:   小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100.但是他并不满足于此,他在想究竟有多少种连续的正数序列的和为100(至少包括两个数). ...

  6. CodeIgniter-CI之MySQL

    首先我们需要进行一下配置,这里需要修改的文件为application目录下的config目录下的database.php文件,我们修改相应的配置项,比如这里是我的配置情况: 通常我们在操作数据库之前, ...

  7. [ZJOI2016]小星星(容斥+dp)

    洛谷链接:https://www.luogu.org/problemnew/show/P3349 题意相当于给一棵树重新赋予彼此不同的编号,要求树上相邻的两个节点在给定的另外一个无向图中也存在边相连. ...

  8. C#那20道题

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  9. 26.bulk批量操作

    主要知识点 1.bulk语法 2.bulk使用时的注意事项 3.bulk size 对es性能的影响     一.bulk语法 每一个操作要两个json串(delete操作除外),每个json串占一行 ...

  10. 通过redis协议构建脏字过滤微服务

    下载 https://github.com/jonnywang/... 安装使用 mkdir -p /data/server/wordsFilter cd /data/server/wordsFilt ...