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. Assembly之example

    Here is a simple example by assembly language. It is based on openMSP430. Very important is to under ...

  2. logical vs physical address

    Logical vs physical address  1) An address generated by the CPU is a logical address. Whereas, an ad ...

  3. webpack学习(四)— webpack-dev-server

    webpack提供给我们检查压缩代码的功能之外,还提供了1个服务器的插件,这就是webpack-dev-server,利用这个差价我们可以启动个web服务器并时时更新我们的修改. 下面以1个简单的例子 ...

  4. react和vue对比

    相同点 都支持服务器端渲染 都有Virtual DOM,组件化开发,通过props参数进行父子组件数据的传递,都实现webComponent规范 数据驱动视图 都有支持native的方案,React的 ...

  5. Apex语言(四)选择(决策)结构

    1.选择结构 选择结构是当满足某个条件或不满足某个条件时,需要进行决策以控制执行的流程. 2.if语句 if语句由布尔表达式后跟一个或多个语句组成. [格式] if(条件表达式){ 语句: } [流程 ...

  6. 51nod1079 中国剩余定理【数论】

    一个正整数K,给出K Mod 一些质数的结果,求符合条件的最小的K.例如,K % 2 = 1, K % 3 = 2, K % 5 = 3.符合条件的最小的K = 23. Input 第1行:1个数N表 ...

  7. [luogu3231 HNOI2013] 消毒 (二分图最小点覆盖)

    传送门 Description 最近在生物实验室工作的小T遇到了大麻烦. 由于实验室最近升级的缘故,他的分格实验皿是一个长方体,其尺寸为abc,a.b.c 均为正整数.为了实验的方便,它被划分为abc ...

  8. [poj3565] Ants (二分图带权匹配)

    传送门 Description 年轻自然主义者比尔在学校研究蚂蚁. 他的蚂蚁以苹果树上苹果为食. 每个蚁群都需要自己的苹果树来养活自己. 比尔有一张坐标为 n 个蚁群和 n 棵苹果树的地图. 他知道蚂 ...

  9. 16._source元数据

  10. Bootstrap关于表单控件(Radio,CheckBox)

    表单控件(复选框checkbox和单选择按钮radio) Bootstrap框架中checkbox和radio有点特殊,Bootstrap针对他们做了一些特殊化处理,主要是checkbox和radio ...