Description

Arya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that guarantees they will win, but implementing this plan requires presence of them all. That means if one day at least one of Arya's opponents is absent at the school, then Arya will beat all present opponents. Otherwise, if all opponents are present, then they will beat Arya.

For each opponent Arya knows his schedule — whether or not he is going to present on each particular day. Tell him the maximum number of consecutive days that he will beat all present opponents.

Note, that if some day there are no opponents present, Arya still considers he beats all the present opponents.

Input

The first line of the input contains two integers n and d (1 ≤ n, d ≤ 100) — the number of opponents and the number of days, respectively.

The i-th of the following d lines contains a string of length n consisting of characters '0' and '1'. The j-th character of this string is '0' if the j-th opponent is going to be absent on the i-th day.

Output

Print the only integer — the maximum number of consecutive days that Arya will beat all present opponents.

Sample Input

Input
2 2
10
00
Output
2
Input
4 1
0100
Output
1
Input
4 5
1101
1111
0110
1011
1111
Output
2

题意:

Arya与n个对手每天打一架,当这一天n个对手全部来时Arya就输了,否则就是Arya赢,求最大连胜天数。

附AC代码:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std; int main( )
{
int n,d,i,j,k=,c=,l=,max=;
char a[];
scanf("%d %d",&n,&d);
for(i=;i<d;i++)
{
c=;
scanf("%s",a);
l=strlen(a);
for(j=;j<l;j++)
{
if(a[j]=='')
{
c+=;
}
}
if(c!=l)
{
k+=;
}
if(k>max)
{
max=k;
}
if(c==l)
{
k=;
}
}
printf("%d\n",max);
return ;
}

D - Opponents的更多相关文章

  1. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  2. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  3. CodeForces 688A Opponents (水题)

    题意:给定 n 行数,让你找出连续最多的全是1的个数. 析:好像也没什么可说的,那就判断一下,并不断更新最大值呗. 代码如下: #include <iostream> #include & ...

  4. 【CodeForces688A】Opponents

    [思路分析] 比较水的模拟题 具体见代码吧 #include<iostream> #include<cstdio> #include<algorithm> usin ...

  5. Google云平台对于2014世界杯半决赛的预测,德国阿根廷胜!

    由于本人是个足球迷,前段日子Google利用自己云平台预测世界杯八进四的比赛并取得了75%的正确率的事情让我振动不小.虽然这些年一直听说大数据的预测和看趋势能力如何如何强大,但这次的感受更加震撼,因为 ...

  6. blade and soul Group Combos

    Group Combos A martial artist always make friends along their way. They learn how to work and fight ...

  7. blade and soul races guide

    Race Four races are available for those who wish to choose the path of martial arts: the careful Gon ...

  8. MOTION-MATCHING IN UBISOFT’S FOR HONOR翻译

    http://www.gameanim.com/2016/05/03/motion-matching-ubisofts-honor/ Introducing For Honor with a vide ...

  9. 套题 codeforces 360

    A题:Opponents 直接模拟 #include <bits/stdc++.h> using namespace std; ]; int main() { int n,k; while ...

随机推荐

  1. leetcode第一刷_Permutation Sequence

    这道题还挺好的,假设你的思路是每次生成一个全排列,然后累计到k次,那么停下来吧.肯定超时了亲.. 微软今年的笔试题里有一道类似的,我之前已经提到过了.是唯独0和1的字符串,求第k个排列是什么样子的.这 ...

  2. DDR硬件设计要点详解(包括电源部分)

    转自 http://www.fairchildic.org/module/forum/thread-658-1-1.html (原帖包括详细的附件内容) 1. 电源 DDR的电源可以分为三类A.主电源 ...

  3. Django-model_form

    ModelForm a. class Meta: model, # 对应Model的 fields=None, # 字段 exclude=None, # 排除字段 labels=None, # 提示信 ...

  4. Markdown 语法的超快速上手

    本文支持WTFPL协议,因此你想往哪转就往哪转. Why markdown? Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式. Ma ...

  5. vim tips 集锦

    删除文件中的空行 :g/^$/d g 表示 global,全文件 ^ 是行开始,$ 是行结束 d 表示删除该 这里只能匹配到没有白空符的空行,假如要删除有空白符的空行,则使用: :g/^\s*$/d ...

  6. 九度OJ 1108:堆栈的使用 (堆栈)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6705 解决:1974 题目描述: 堆栈是一种基本的数据结构.堆栈具有两种基本操作方式,push 和 pop.Push一个值会将其压入栈顶, ...

  7. windows server 2008 + IIS 7.5实现多用户FTP(多账号对应不同目录

    在windows server 2003 + IIS 6 的时候,就已经能实现多用户FTP的功能,不过设置有写繁琐,如果站点多的话,设置账号.权限这些东西都要搞很久.Windows server 20 ...

  8. UVA10689 Yet another Number Sequence —— 斐波那契、矩阵快速幂

    题目链接:https://vjudge.net/problem/UVA-10689 题解: 代码如下: #include <iostream> #include <cstdio> ...

  9. XML中CDATA和#PCDATA的区别

    在XML文档中, 能看到“CDATA"的地方有三处: 1)在DTD中,指定标签中某个属性的类型为字符型时,使用CDATA.因为XML解析器会去分析这段字符内容,因而里面如果需要使用>, ...

  10. HTML页面下雪特效

    1. [代码][HTML]代码     <a  href="javascript:void(function(){var d = document,a = 'setAttribute' ...