D - Opponents
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
Input2 2
10
00Output2Input4 1
0100Output1Input4 5
1101
1111
0110
1011
1111Output2
题意:
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的更多相关文章
- Codeforces Round #360 (Div. 2) A. Opponents 水题
A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...
- codeforces 688A A. Opponents(水题)
题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- CodeForces 688A Opponents (水题)
题意:给定 n 行数,让你找出连续最多的全是1的个数. 析:好像也没什么可说的,那就判断一下,并不断更新最大值呗. 代码如下: #include <iostream> #include & ...
- 【CodeForces688A】Opponents
[思路分析] 比较水的模拟题 具体见代码吧 #include<iostream> #include<cstdio> #include<algorithm> usin ...
- Google云平台对于2014世界杯半决赛的预测,德国阿根廷胜!
由于本人是个足球迷,前段日子Google利用自己云平台预测世界杯八进四的比赛并取得了75%的正确率的事情让我振动不小.虽然这些年一直听说大数据的预测和看趋势能力如何如何强大,但这次的感受更加震撼,因为 ...
- blade and soul Group Combos
Group Combos A martial artist always make friends along their way. They learn how to work and fight ...
- blade and soul races guide
Race Four races are available for those who wish to choose the path of martial arts: the careful Gon ...
- MOTION-MATCHING IN UBISOFT’S FOR HONOR翻译
http://www.gameanim.com/2016/05/03/motion-matching-ubisofts-honor/ Introducing For Honor with a vide ...
- 套题 codeforces 360
A题:Opponents 直接模拟 #include <bits/stdc++.h> using namespace std; ]; int main() { int n,k; while ...
随机推荐
- caffe训练自己的图片进行分类预测--windows平台
caffe训练自己的图片进行分类预测 标签: caffe预测 2017-03-08 21:17 273人阅读 评论(0) 收藏 举报 分类: caffe之旅(4) 版权声明:本文为博主原创文章,未 ...
- MVC上传多张图片
改变上传文件的按钮样式: <div id="post-upload-image"> <div id="divfile_-1"> < ...
- 安卓版本6.0打开uiautomator报错
可能是appium打开了,被占用:或者是找不到手机
- centos 在CentOS下编译FFmpeg
所需软件 准备 yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel -y 新版还 ...
- ffmpeg下载rtmp flv
ffmpeg -i rtmp://shanghai.chinatax.gov.cn:1935/fmsApp/16a0148f117.flv -c copy dump.flv
- 在OC项目中实现swift与oc混编 相互引用
--------------------------------------------------------Begin--------------------------------------- ...
- lua 定义类 就是这么简单
在网上看到这样一段代码,真是误人子弟呀,具体就是: lua类的定义 代码如下: local clsNames = {} local __setmetatable = setmetatable loca ...
- PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/redis.so' - /usr/lib64/php/modules/redis.so: undefined symbol: igbinary_serialize in Unknown on line 0
网上找到两种解决方法, 1.先删除php-pecl-redis,再用pecl install redis 2.安装php-igbinary模块,不过我安装时包冲突了,没有安装成功,所以用了第一种方法
- Impala 安装笔记3一impala安装
安装impala之前,确认满足Cloudera Impala Requirements中要求的所有条件: Supported Operating Systems Supported CDH Versi ...
- Unity导包配置详解
Player Settings is where you define various parameters (platform specific) for the final game that y ...