#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的更多相关文章

  1. 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 ...

  2. Office 365系列(三) -Office 365 Pro plus 安装

    这一篇博客主要是说Office 365 Pro plus安装. 1. 当登陆到Office 365以后,点击右边链接“下载软件” 2. 安装最新Office 软件 3. 采用点对点安装,当安装成功以后 ...

  3. Codeforces 617 E. XOR and Favorite Number

    题目链接:http://codeforces.com/problemset/problem/617/E 一看这种区间查询的题目,考虑一下莫队. 如何${O(1)}$的修改和查询呢? 令${f(i,j) ...

  4. 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 ...

  5. 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 ...

  6. 【第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 ...

  7. Codeforces 617E:XOR and Favorite Number(莫队算法)

    http://codeforces.com/problemset/problem/617/E 题意:给出n个数,q个询问区间,问这个区间里面有多少个区间[i,j]可以使得ai^ai+1^...^aj ...

  8. codeforces 617 E. XOR and Favorite Number(莫队算法)

    题目链接:http://codeforces.com/problemset/problem/617/E 题目: 给你a1 a2 a3 ··· an 个数,m次询问:在[L, R] 里面又多少中 [l, ...

  9. Codeforces Round #651 (Div. 2) C. Number Game(数论)

    题目链接:https://codeforces.com/contest/1370/problem/C 题意 给出一个正整数 $n$,Ashishgup 和 FastestFinger 依次选择执行以下 ...

随机推荐

  1. C#常用设计模式--单例模式

    为什么要使用单例模式 在我们的整个游戏生命周期当中,有很多对象从始至终有且只有一个.这个唯一的实例只需要生成一次,并且直到游戏结束才需要销毁.  单例模式一般应用于管理器类,或者是一些需要持久化存在的 ...

  2. php7中异常

    php7中新增异常错误处理 在PHP7之前的版本,对于一些错误异常是没有办法捕获的. php7中新增throwable接口,可以用来捕获一些错误 Exception,Error这实现了Throwabl ...

  3. Linux上安装Nginx依赖环境和库、Nginx安装,Nginx服务命令

    安装Nginx依赖环境和库.Nginx安装,Nginx服务命令 因为Nginx官方提供的是C源码,要自己进行编译,所以需要自己拥有编译所依赖的环境和库才可正常编译 安装gcc yum -y insta ...

  4. Arrays工具类常用方法演示

    java.util.Arrays是JDK中操作数组的工具类,包含了用来操作数组(比如排序和搜索)的各种方法. 下面我们以int类型数组为例,学习下常用的方法,其他类型数组都差不多. 1.equals( ...

  5. xshell传送文件

    xshel是一款非常好的ssh远程登入的软件,最近在玩hadoop发现的想把widows上的文件通过xshell直接传送到虚拟机中 这个解决方法还是非常不错的 https://jingyan.baid ...

  6. tomcat 启动窗口 名称 中文乱码

  7. 控制台程序秒变Windows服务(Topshelf)

    项目中有些时候需要写服务,一般我们都是先创建控制台程序,测试,运行,成功之后再创建windows服务程序,这样好麻烦啊,有没有简单的控制台程序直接变成Widnows服务,经过查找,找到了Topshel ...

  8. SQL Server 2016 + AlwaysOn 无域集群

    目录 AlwaysOn 搭建 WSFC 配置计算机的 DNS 后缀 安装故障转移集群 验证集群 创建集群 创建文件共享见证 配置 AlwaysOn 新建可用性组 创建侦听器 可读副本的负载均衡 主角色 ...

  9. AD域和LDAP协议

    随着我们的习大大上台后,国家在网络信息安全方面就有了很明显的改变!所以现在好多做网络信息安全产品的公司和需要网络信息安全的公司都会提到用AD域服务器来验证,这里就简单的研究了一下! 先简单的讲讲AD域 ...

  10. C++中 / 和 % 在分离各位时的妙用

    在学习c++的过程中,我们一般用 / 和 % 来分解数字的各个位 取整 (/) 比如1234 / 10 等于 123.4,这相当于把前三位分解出来了 取余(%) 比如 12345 的分解方法 个位:1 ...