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)
{
memset(vis, false, sizeof(vis));
if (x == 0)
vis[0] = true;
while (x)
{
vis[x%10] = true;
x /= 10;
}
for (int i = 0; i <= k; i++)
if (vis[i] == false)
return false;
return true;
}
int main()
{
int x;
while (scanf("%d %d", &n, &k) != EOF)
{
int ans = 0;
for (int i = 1; i <= n; i++)
{
scanf("%d", &x);
if (judge(x))
ans++;
}
printf("%d\n", ans);
}
return 0;
}
B,求序列中最长满足斐波那契性质的序列长度。
#include <stdio.h> int a[100005]; int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
int ans = 0;
int len = 0;
for (int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
if (i > 2)
{
if (a[i] == a[i-1] + a[i-2])
{
len++;
if (len > ans)
ans = len;
}
else
{
len = 0;
}
}
}
if (n < 2)
printf("%d\n", n);
else
printf("%d\n", ans+2);
}
return 0;
}
codeforces 213div(2) 365 A.Good Number 365 B.The Fibonacci Segment的更多相关文章
- Codeforces Beta Round #51 B. Smallest number dfs
B. Smallest number Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55/pro ...
- Office 365系列(三) -Office 365 Pro plus 安装
这一篇博客主要是说Office 365 Pro plus安装. 1. 当登陆到Office 365以后,点击右边链接“下载软件” 2. 安装最新Office 软件 3. 采用点对点安装,当安装成功以后 ...
- Codeforces 617 E. XOR and Favorite Number
题目链接:http://codeforces.com/problemset/problem/617/E 一看这种区间查询的题目,考虑一下莫队. 如何${O(1)}$的修改和查询呢? 令${f(i,j) ...
- codeforces 617E E. XOR and Favorite Number(莫队算法)
题目链接: E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes i ...
- Codeforces Round #266 (Div. 2) C. Number of Ways
You've got array a[1], a[2], ..., a[n], consisting of n integers. Count the number of ways to split ...
- 【第400篇题解纪念2016年10月28日】【28.10%】【codeforces 617E】XOR and Favorite Number
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Codeforces 617E:XOR and Favorite Number(莫队算法)
http://codeforces.com/problemset/problem/617/E 题意:给出n个数,q个询问区间,问这个区间里面有多少个区间[i,j]可以使得ai^ai+1^...^aj ...
- codeforces 617 E. XOR and Favorite Number(莫队算法)
题目链接:http://codeforces.com/problemset/problem/617/E 题目: 给你a1 a2 a3 ··· an 个数,m次询问:在[L, R] 里面又多少中 [l, ...
- Codeforces Round #651 (Div. 2) C. Number Game(数论)
题目链接:https://codeforces.com/contest/1370/problem/C 题意 给出一个正整数 $n$,Ashishgup 和 FastestFinger 依次选择执行以下 ...
随机推荐
- 安装Flume——海量日志收集聚合系统
下载flume: 1.官方网站下载: http://flume.apache.org/download.html 2.百度网盘资源: apache-flume-1.9.0-bin.tar 链接:ht ...
- 喵星人教你 HTTP 状态码
在我们日常 Web 开发中,或多或少的都接触过 HTTP 状态码,那这些状态码代表什么意思呢?熟悉这些状态码又有什么好处呢?下面我就为大家一一道来,可以把本片文章'收藏'以备不时之需. HTTP 状态 ...
- Web安全深度剖析
Web安全深度剖析 链接:https://pan.baidu.com/s/15NulgWNzQ2JPCdn9q1jE-g 提取码:6y83 Web安全深度剖析>总结了当前流行的高危漏洞的形 ...
- 如何查看jsplumb.js的API文档(YUIdoc的基本使用)
目录 一.问题描述 二. 处理方法 三. YUIdoc工具介绍 示例代码托管在:http://www.github.com/dashnowords/blogs 博客园地址:<大史住在大前端> ...
- HDU 1561:The more, The Better(有依赖的树型背包)
http://acm.hdu.edu.cn/showproblem.php?pid=1561 题意:有n个点,容量为m,每个点有一个价值,还给出n条边,代表选第i个点之前必须先选ai,问最多的价值能取 ...
- Codeforces 760B:Frodo and pillows(二分)
http://codeforces.com/problemset/problem/760/B 题意:有n张床m个枕头,每张床可以有多个枕头,但是相邻的床的枕头数相差不能超过1,问第k张床最多能拥有的枕 ...
- java接口自动化(一) - 接口自动化测试整体认知 - 开山篇(超详解)
简介 了解什么是接口和为什么要做接口测试.并且知道接口自动化测试应该学习哪些技术以及接口自动化测试的落地过程.其实这些基本上在python接口自动化的文章中已经详细的介绍过了,不清楚的可以过去看看.了 ...
- mysql+mybatis存储超大json
1. 场景描述 因前端界面需存储元素较多,切割后再组装存储的话比较麻烦,就采用大对象直接存储到mysql字段中,根据mysql的介绍可以存放65535个字节,算了算差不多,后来存的时候发现: 一是基本 ...
- ~~番外:说说Python 面向对象编程~~
进击のpython Python 是支持面向对象的 很多情况下使用面向对象编程会使得代码更加容易扩展,并且可维护性更高 但是如果你写的多了或者某一对象非常复杂了,其中的一些写法会相当相当繁琐 而且我们 ...
- android_layout_linearlayout(二)
android的线性布局linearlayout的研究没有尽头.看了官网关于线性布局的一个例子,捣鼓一阵,发现的迷惑记录在此. 一.先看看官网xml <?xml version="1. ...