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 ...
随机推荐
- HDU 3371 kruscal/prim求最小生成树 Connect the Cities 大坑大坑
这个时间短 700多s #include<stdio.h> #include<string.h> #include<iostream> #include<al ...
- PhpStorm主题
图的github仓库有很多编辑器的主题,jetbrains目录下都是PhpStorm支持的主题 1.到http://daylerees.github.io/预览各个主题的风格,找到自己喜欢的: 2.在 ...
- 分享一个Cnblogs简易APP
最近在学习Android app的开发,俗话说万事开头难,本人也不例外.计算机编程是属于一门要求动手能力和动脑能力都很强的学科,相信很多人都会有这样的经历,看得懂不去用,过不了几天也就忘记了.因而,在 ...
- Delphi经验总结(3)
------------------------------------------------------- ◇删掉程序自己的exe文件 procedure TForm1.FormClose(Sen ...
- ORACLE查询当前资产状态,和另一个数据库联查,(查询重复数据中第一条),子查询作为字段查询
背景:ORACLE查询当前资产状态,包含资产信息(表1),资产维修状态(表2),资产报废状态(表3) 如下: 资产信息:
- 个人博客转移到CSDN
因个人博客编辑的需要,现将我的博客转移到CSDN,如果没有特别需要,以后会在CSDN上继续书写博客 关于Fresco的分析以及后续的相关分析,也会转移到CSDN 个人CSDN主页: http://bl ...
- Solr学习笔记(一)
最近准备为一个产品做一个站内的搜索引擎,是一个java产品.由于原来做过Lucene.net,所以自然而然的就想到了使用Lucene.在复习Lucene的过程中发现了Solr这个和Lucene绑定在一 ...
- ASP.NET MVC那些事
MVC的由来: 在MVC模式之前,View界面的呈现.用户交互操作的捕捉与相应.业务流程的执行以及数据的存储等都是在一起的,这种设计模式叫自治视图. 这重设计模式主要存在三大弊端: 重用性:业务逻辑与 ...
- 查询MYSQL和查询HBASE速度比较
上一篇文章:我要上谷歌 Mysql,关系型数据库: HBase,NoSql数据库. 查询Mysql和查询HBase,到底哪个速度快呢? 与一些真正的大牛讨论时,他们说HBase写入速度,可以达到每秒1 ...
- Ubuntu下编译Chromium for Android
转自:http://blog.csdn.net/fsz521/article/details/18036835 下源码git clone https://chromium.googlesource.c ...