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 ...
随机推荐
- 推荐系统入门:作为Rank系统的推荐系统(协同过滤)
知乎:如何学习推荐系统? 知乎:协同过滤和基于内容的推荐有什么区别? 案例:推荐系统实战? 数据准备:实现推荐栏位:重构接口:后续优化. 简书:实现实时推荐系统的三种方式?基于聚类和协同过滤:基于S ...
- Matlab atan2
对Matlab不是很熟悉,在这个Matlab atan2 函数上出现了问题. 百度知道上的解释是这样的: atan2() 区别于 atan() 函数,返回 -pi~+pi 范围的角度: 使用过程中发现 ...
- 【汇编】dosbox钢琴
DATA SEGMENT msg DB 0DH,0AH,'[ 1 2 3 4 5 6 7 ]' DB 0DH,0AH,' [ q w e r t y u ]' DB 0DH,0AH,'________ ...
- Python之数据结构改造
{ "appList":[ { "id" : 120, "name" : "BIGDATA", "alias& ...
- php多进程防止出现僵尸进程
对于用PHP进行多进程并发编程,不可避免要遇到僵尸进程的问题. 僵尸进程是指的父进程已经退出,而该进程dead之后没有进程接受,就成为僵尸进程(zombie)进程.任何进程在退出前(使用exit退出) ...
- swift-UITextfield控件的基本属性设置
//1.初始化UITextField let userName=UITextField(frame: CGRectMake(0, 100, 100, 100)); //2.将文本框userName添加 ...
- 面试官问你如何解决web高并发这样回答就好了
所谓高并发,就是同一时间有很多流量(通常指用户)访问程序的接口.页面及其他资源,解决高并发就是当流量峰值到来时保证程序的稳定性. 我们一般用QPS(每秒查询数,又叫每秒请求数)来衡量程序的综合性能,数 ...
- java IO框架分析
jave.io框架 2010-11-10 22:18:34| 分类: 默认分类|举报|字号 订阅 可从IO的类层次,IO框架的设计模式来论述. 总体来说,IO可以分为字节流和字符流,不同在于 ...
- android下xml放哪儿?
1.用Project->Deployment,打开发布文件窗口,增加要发布的文件.然后设置文件发布的位置Remote Path,填写为assets\internal\ 2.代码 varp: st ...
- 【*2000】【2018-2019 ICPC, NEERC, Southern Subregional Contest C 】Cloud Computing
[链接] 我是链接,点我呀:) [题意] [题解] 我们可以很容易知道区间的每个位置有哪些安排可以用. 显然 我们优先用那些花费的钱比较少的租用cpu方案. 但一个方案可供租用的cpu有限. 我们可以 ...