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 ...
随机推荐
- C#使用wkhtmltopdf,把HTML生成PDF(包含分页)
最近花了2天多的时间终于把HTML生成PDF弄好了.步骤如下: 1.首先是技术选型.看了好多都是收费的就不考虑了. 免费的有: jsPDF(前端生成,清晰度不高,生成比较慢) iText(严格要求ht ...
- PostgreSQL的HA解决方案-1主从和备份(master/slave and backup)
一.部署说明 1.1 实施环境 本文档实验环境如下: PGSQL主机: 192.168.1.45 PGSQL备机: 192.168.1.50 软件和系统版本 Pgsql 版本: pgsql 9.2.4 ...
- MyEclipse获取注册码
最近刚装上MyEclipse,一直弹窗提示注册码过期,开始还能接受,到最后,每发布一个项目便弹窗提醒,顿时感觉烦了,得治理治理这个烦人的注册码,下面是一段自动生成注册名和注册码的代码,只需要直接拿来用 ...
- 红黑联盟 php相关资讯
http://www.2cto.com/tag/phpbanben.html
- Maven常见异常及解决方法
异常1: [ERROR] Failed to execute goal on project biz_zhuhai: Could not resolve dependencies for projec ...
- SP1825 FTOUR2 - Free tour II 点分治+启发式合并+未调完
题意翻译 给定一棵n个点的树,树上有m个黑点,求出一条路径,使得这条路径经过的黑点数小于等于k,且路径长度最大 Code: #include <bits/stdc++.h> using n ...
- 【剑指Offer】15、反转链表
题目描述: 输入一个链表,反转链表后,输出新链表的表头. 解题思路: 本题比较简单,有两种方法可以实现:(1)三指针.使用三个指针,分别指向当前遍历到的结点.它的前一个结点以及后一个结 ...
- 记一次获得 3 倍性能的 go 程序优化实践,及 on-cpu / off-cpu 火焰图的使用
转自:https://mp.weixin.qq.com/s/9IKaXeWTiiQTFlvZzxgsEA 记一次获得 3 倍性能的 go 程序优化实践,及 on-cpu / off-cpu 火焰图的使 ...
- android 手机网络接入点名称及WAP、NET模式的区别
移动 电信 联通 APN cmwap cmnet ctwap ctnet 3gwap uniwap 3gnet uninet设置 APN(Access Point Name),即“接入点名称”,用来标 ...
- Python列表的复制
1.直接按名字赋值: my_habit = ['game', 'running'] friend_habit = my_habit my_habit.append('swimming') friend ...