codeforces 712A. Memory and Crow
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的更多相关文章
- codeforces 712A A. Memory and Crow(水题)
		
题目链接: A. Memory and Crow time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
 - Codeforce 712A Memory and Crow
		
A. Memory and Crow time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
 - 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 ...
 - 《Linux内核精髓:精通Linux内核必会的75个绝技》一HACK #12 使用Memory Cgroup限制内存使用量
		
HACK #12 使用Memory Cgroup限制内存使用量 Memory Cgroup是Cgroup的资源限制功能之一,可以控制特定进程可以使用的内存量.Memory CgroupMemory C ...
 - 3.1 全局存储带宽与合并访问 -- Global Memory(DRAM) bandwidth and memory coalesce
		
全局存储带宽(DRAM) 全局内存是动态随机访问的方式访问内存.我们希望访问DRAM的时候非常快,实际情况是DRAM中出来的数据非常非常慢,这就好比,理想状态是泄洪,水倾巢而出,气势宏伟,实际取水却像 ...
 - codeforces 712A. Memory and Crow
		
题目链接:http://codeforces.com/problemset/problem/712/A 题目大意: 给你一个数字系列,求其满足条件的一个序列. 条件为: ai = bi - bi + ...
 - CodeForces 712A Memory and Crow (水题)
		
题意:有一个序列,然后对每一个进行ai = bi - bi + 1 + bi + 2 - bi + 3.... 的操作,最后得到了a 序列,给定 a 序列,求原序列. 析:很容易看出来,bi = ai ...
 - 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 ...
 - Android内存管理(4)*官方教程 含「高效内存的16条策略」 Managing Your App's Memory
		
Managing Your App's Memory In this document How Android Manages Memory Sharing Memory Allocating and ...
 
随机推荐
- Mongo连接远程数据库
			
mongo IP+Port CrabyterV5 首先这么操作是基于配置了环境变量的,可以参照http://www.cnblogs.com/daiyonghui/p/5209076.html mong ...
 - C# FormClosing FormClosed 区别详解
			
FormClosing事件 在窗体关闭时,FormClosing事件发生.此事件会得到处理.从而释放与窗体相关的所有资源. 如果取消此事件,则窗体仍然保持打开状态. 当窗体显示为模式对话框时,单击“关 ...
 - 2星|《工业X.0》:物联网的资料汇编
			
工业X.0:实现工业领域数字价值 看完比较失望,没有看到新的观点想法.基本算是物联网的资料汇编.总体评价2星. 以下是书中一些内容的摘抄: 1:例如,埃森哲为其员工开发了一个用例,用增强现实技术解决实 ...
 - linux route命令的使用详解(转)
			
route命令用于显示和操作IP路由表.要实现两个不同的子网之间的通信,需要一台连接两个网络的路由器,或者同时位于两个网络的网关来实现.在Linux系统中,设置路由通常是 为了解决以下问题:该Linu ...
 - day006 数字类型和字符串类型的内置方法
			
首先,为什么要有数据类型? 对于不同类型的变量,需要用不同的数据类型去描述. 数字类型的内置方法 数据类型又分为整形和浮点型.以下所述的内置方法均适用于这两个类型. 必须掌握的方法*** 数据类型有基 ...
 - 物理cpu与逻辑cpu概述
			
物理cpu与逻辑cpu概述(本博客属于转载部分内容:主要学习目的用于大数据平台Hadoop之yarn资源调度的配置) 一.yarn资源调度器中主要的资源分类 1.memory(内存) 2. ...
 - codeforces 427D Match & Catch(后缀数组,字符串)
			
题目 参考:http://blog.csdn.net/xiefubao/article/details/24934617 题意:给两个字符串,求一个最短的子串.使得这个子串在两个字符串中出现的次数都等 ...
 - Bootstrap 表单控件状态(禁用状态)
			
Bootstrap框架的表单控件的禁用状态和普通的表单禁用状态实现方法是一样的,在相应的表单控件上添加属性“disabled”.和其他表单的禁用状态不同的是,Bootstrap框架做了一些样式风格的处 ...
 - Spring Cloud-hystrix Feign(九)
			
前面使用ribbon拦截RestTemplate 实现服务的负载均衡 使用Hystrix进行熔断降级请求缓存 用原生的方式 将会有大量的模板代码,feigin就是rabbon和Histrix的整合 ...
 - Spring Boot-整合redis(六)
			
redis安装 参考:https://www.cnblogs.com/LQBlog/p/9214517.html 单机版 1.添加pom依赖 <!-- Spring Boot Reids 依赖 ...