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 ...
随机推荐
- Html form 表单提交前验证
可以使用form表单的onsubmit方法,在提交表单之前,对表单或者网页中的数据进行检验. onsubmit指定的方法返回true,则提交数据:返回false不提交数据. 直接看下面的代码: 1 & ...
- RTX登录其他系统
前台: <html> <head> <title>签名验证</title> <meta http-equiv="Content-Lang ...
- 惊魂web应用宕机记一次网站的紧急恢复
这次网站的故障出现的比较突然,没有任何防备,有种突如其来的感觉.这是一台阿里云服务器,采用wdcp的nginx+apache+mysql的方式运行.一位同事在对web目录进行压缩后,由于web目录有很 ...
- iOS 中NSOperationQueue,Grand Central Dispatch , Thread的上下关系和区别
In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central D ...
- Java for LeetCode 045 Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- elk平台分析nginx日志的基本搭建
一.elk套件介绍 ELK 由 ElasticSearch . Logstash 和 Kiabana 三个开源工具组成.官方网站: https://www.elastic.co/products El ...
- codeforces A. Xenia and Divisors 解题报告
题目链接:http://codeforces.com/problemset/problem/342/A 题目意思:给出n个数,找出n/3个组且每组有3个数,这三个数必须要符合两个条件:1.a < ...
- GLSL的qualifier
uniform:从应用程序到vertex shader 到fragment shader都能使用,但是值一直不变: varying:从vertex shader到fragment shader,在fr ...
- rds材资收集
rds:简称云数据库(Relational Database Service) RDS目前支持的数据库类型有两种:mysql,sqlserver. 阿里云RDS数据库教程菜鸟如何玩转阿里云RDS?:h ...
- undefined reference to 'typeinfo for android::Thread'
原因:工程使用了系统库libstagefright.so,而该库是Android系统用no-rtti方式编译出来的,因此我们的工程也必须要用no-rtti方式编译. 解决方法:在Application ...