Codeforces Round #213 (Div. 2) B. The Fibonacci Segment
#include <iostream>
#include <algorithm>
#include <vector> using namespace std; int main(){
int n;
cin >> n;
vector<int> a(n);
for(int i = ; i < n; ++ i)
cin >> a[i];
int maxlen = ;
if(n == ) maxlen = ;
else if(n == ) maxlen = ;
else{
maxlen = ;
int l = , r =;
for(int i = ; i < n; ++ i){
if(a[i] == a[i-] + a[i-]){
r = i;
if(maxlen < r-l+){
maxlen = r-l+;
}
}
else{
l = i-;
}
}
}
cout<<maxlen<<endl;
return ;
}
Codeforces Round #213 (Div. 2) B. The Fibonacci Segment的更多相关文章
- Codeforces Round #213 (Div. 2) A. Good Number
#include <iostream> #include <vector> using namespace std; int main(){ ; cin >> n ...
- Codeforces Round #213 (Div. 1) B - Free Market 思维+背包 好题
B - Free Market 思路:这个题怎么说呢,迷惑性很大,题目里说了交换了两个集合的时候如果有相同元素不能交换,感觉如果没 这句话能很快写出来, 其实当交换的两个集合有重复元素的时候只要交换那 ...
- Codeforces Round #149 (Div. 2) E. XOR on Segment (线段树成段更新+二进制)
题目链接:http://codeforces.com/problemset/problem/242/E 给你n个数,m个操作,操作1是查询l到r之间的和,操作2是将l到r之间的每个数xor与x. 这题 ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
随机推荐
- ZeroMQ(java)中监控Socket
基本上ZeroMQ(java)中基本的代码都算是过了一遍了吧,不过觉得它在日志这一块貌似基本没有做什么工作,也就是我们通过日志来知道ZeroMQ都发生了什么事情.. 而且由于ZeroMQ中将连接的建立 ...
- 《linux备份与恢复之一》.tar.bz2与.tar.gz格式的文本压缩率比较
对于文本压缩,据说bzip的算法要优于gzip,从而拥有更好的压缩比.特地找了两个文件来做一下测试,以下为测试结果: (1)源文件为591MB, .tar.bz2文件为61MB(10.32%), ...
- sublime text多文件夹查找关键字
Ctrl+shift+F 快捷键在文件夹内查找,与普通编辑器不同的地方是sublime允许添加多个文件夹进行查找 转自:http://www.douban.com/note/362268947/
- python下的MySQLdb使用
下载安装MySQLdb <1>linux版本 http://sourceforge.net/projects/mysql-python/ 下载,在安装是要先安装setuptools,然后在 ...
- [Ant] Ant之MacroDef—“宏
转载自:http://lhq1013.iteye.com/blog/1157234 Ant是一个基于Java的跨平台构建工具,它易于使用,并且可扩展.可升级. MacroDef——“宏”,在An ...
- Shallow Size 和 Retained Size
所有包含Heap Profling功能的工具(MAT, Yourkit, JProfiler, TPTP等)都会使用到两个名词,一个是Shallow Size,另一个是 Retained Size. ...
- opencv学习笔记(三)基本数据类型
opencv学习笔记(三)基本数据类型 类:DataType 将C++数据类型转换为对应的opencv数据类型 OpenCV原始数据类型的特征模版.OpenCV的原始数据类型包括unsigned ch ...
- Linux系统如何查看CPU型号等
有时候在下载jdk或其它用图的时候,可能需要查看一下这个cpu的型号 [root@subvm ~]# less /proc/cpuinfo |grep modelmodel : 4 ...
- iptables 无法连外网
[root@v01-svn-test-server ~]# service iptables status Table: filter Chain INPUT (policy DROP) num ta ...
- Java Hour 40 Maven ( 2 )
有句名言,叫做10000小时成为某一个领域的专家.姑且不辩论这句话是否正确,让我们到达10000小时的时候再回头来看吧. Hour 40 Maven 坐标 任何一个包都需要一个全世界唯一的id, Ma ...