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. Ffmpeg 实现文件切割

    文件切割是一项很常见的基本功能,通过Ffmpeg可以很容易实现这项功能. 首先介绍下基本原理,文件切割说白了就过滤掉文件的部分音视频包,按照什么规则过滤呢? 答案是时间戳.文件中每个视频及音频包都有时 ...

  2. git 忽略文件的三种方式

    1. 在项目目录下新建.gitignore文件并添加规则 特点:此种方式的忽略规则只局限于本项目目录及其子目录,并且.gitignore文件会被提交到远程仓库进行共享忽略规则. 2. 在.git/in ...

  3. Linux free显示讲解

    http://www.cnblogs.com/coldplayerest/archive/2010/02/20/1669949.html 解释一下Linux上free命令的输出. 下面是free的运行 ...

  4. MVC上传多张图片

    改变上传文件的按钮样式: <div id="post-upload-image"> <div id="divfile_-1"> < ...

  5. GuozhongCrawler系列教程 (1) 三大PageDownloader

    GuozhongCrawler  QQ群 202568714 教程源代码下载地址:http://pan.baidu.com/s/1pJBmerL GuozhongCrawler内置三大PageDown ...

  6. linux安装ssh(转载)

    CentOS安装ssh最笨的方法:yum install ssh yum install openssh-server/etc/init.d/sshd status看sshd服务的状态/etc/ini ...

  7. ios 博客集合

    ryantang03     http://blog.csdn.net/ryantang03/article/category/1073221 kmyhy   http://blog.csdn.net ...

  8. toad for oracle中文显示乱码

    toad for oracle中文显示乱码 数据入库的时候中文显示正常,在toad for oracleclient和页面显示都是乱码!!! 原因:在数据入库时候出现的问题. 解决方式: 在系统变量中 ...

  9. 在与SQL Server 建立 连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器

  10. Golang RPC 性能测试

    Golang RPC 性能测试 | KDF5000 http://kdf5000.com/2017/03/28/Golang-RPC-性能测试/