cf B. The Fibonacci Segment
http://codeforces.com/contest/365/problem/B
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 200010
#define LL __int64
using namespace std; int n;
LL a[maxn]; int main()
{
while(scanf("%d",&n)!=EOF)
{
for(int i=; i<=n; i++)
{
scanf("%I64d",&a[i]);
}
int max1=min(,n);
int len=;
for(int i=; i<=n; i++)
{
if(a[i]==a[i-]+a[i-])
{
len++;
max1=max(max1,len);
}
else len=;
}
printf("%d\n",max1);
}
return ;
}
cf B. The Fibonacci Segment的更多相关文章
- CF#213DIV2:B The Fibonacci Segment
You have array a1, a2, ..., an. Segment [l, r] (1 ≤ l ≤ r ≤ n) is good if ai = ai - 1 + ai - 2, for ...
- codeforces B. The Fibonacci Segment 解题报告
题目链接:http://codeforces.com/problemset/problem/365/B 题目意思:简单来说,就是要找出最长的斐波纳契长度. 解决的方法不难,但是要注意更新左区间和右区间 ...
- Codeforces Round #213 (Div. 2) B. The Fibonacci Segment
#include <iostream> #include <algorithm> #include <vector> using namespace std; in ...
- codeforces 213div(2) 365 A.Good Number 365 B.The Fibonacci Segment
#include <stdio.h> #include <string.h> bool vis[11]; int n, k; bool judge(int x) { memse ...
- 【CF 718C】fibonacci
题意 给你一个长度为 \(n\) 的序列 \(a\),有 \(m\) 次操作,操作分两种 \(\text{1}\space \text{l}\space \text{r}\space \text{x} ...
- codeforces365B
The Fibonacci Segment CodeForces - 365B You have array a1, a2, ..., an. Segment [l, r] (1 ≤ l ≤ r ≤ ...
- CF 914 G Sum the Fibonacci —— 子集卷积,FWT
题目:http://codeforces.com/contest/914/problem/G 其实就是把各种都用子集卷积和FWT卷起来算即可: 注意乘 Fibonacci 数组的位置: 子集卷积时不能 ...
- cf 126D - Fibonacci Decomposition
题目大意 \(t\le 10^5\)组询问 每次询问\(1\le n\le 10^{18}\) 求有多少种\(n\)的\(fibonacci\)分解 分解定义为:每个\(fib\)数最多选一个,且和为 ...
- CF 914G Sum the Fibonacci——子集卷积
题目:http://codeforces.com/contest/914/problem/G 第一个括号可以子集卷积:第三个括号可以用 FWT 异或卷积:这样算出选两个数组成 x 的方案数:三个部分的 ...
随机推荐
- 给你讲个笑话,我是创业公司CEO
文/办公室奇葩说(Office 78)一个在办公室较为正经的八卦号. 前几天你看见朋友圈刷屏的文章<给你讲个笑话:我是做互联网的>. 你心想,写文章的那人是傻逼吗?觉得做互联网就是个笑 ...
- MySQL更新死锁问题
作为一个社交类的 App ,我们有很多操作都会同时发生,为了确保数据的一致性,会采用数据库的事物. 比如现在我们有一个点赞操作,点赞成功后,需要更改文章的热度.以下是 SQL 语句: INSERT I ...
- 【转】ArrayList遍历的同时删除----不错
原文网址:http://javag.iteye.com/blog/403097 方法一 ArrayList<String> list = new ArrayList<String&g ...
- Lazy Foo:Game Loops
英文原文连接:http://lazyfoo.net/articles/article04/index.php 废话我也就不翻译了,贴个代码然后注释一下吧. 1.游戏住循环 接收信息,然后操作,最后渲染 ...
- zepto笔记
$.contains: 判断节点是否存在的很好方式[另一个提供类似功能的函数是has] $.grep: 过滤数组 $.type: 获取变量类型 $.closest: 返回最先匹配到的祖先元素 $.ma ...
- Ubuntu16.04下部署 nginx+uwsgi+django1.9.7(虚拟环境pyenv+virtualenv)
由于用的新版本系统,和旧的稍有差别,在网上搜了很多相关资料,搞了三天终于搞好在Ubuntu16.04下的部署,接下来就详细写写步骤以及其中遇到的问题.前提是安装有虚拟环境pyenv+virtualen ...
- C#使用jmail组件发送邮件
1.安装 命令行环境下,到jmail.dll所在目录,运行regsvr32 jmail.dll 2.代码 #region 发送邮件 /// <summary> /// 发送邮件 ...
- Android Paint之 setXfermode PorterDuffXfermode 讲解
setXfermodePorterDuffXfermode图层混合模式android图像混合模式AvoidXfermode 尊重原创,欢迎转载,转载请注明: FROM GA_studio htt ...
- 《Linux Device Drivers》第十二章 PCI司机——note
一个简短的引论 它给这一章总线架构的高级概述 集中访问讨论Peripheral Component Interconnect(PCI,外围组件互连)外设内核函数 PCI公交车是最好的支持的内核总线 本 ...
- 使用boost中的线程池
#include <boost/thread/thread.hpp>#include <boost/bind.hpp>#include <iostream> u ...