CodeForces 688A Opponents

A. Opponents
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Examples
input
2 2
10
00
output
2
input
4 1
0100
output
1
input
4 5
1101
1111
0110
1011
1111
output
2
Note

In the first and the second samples, Arya will beat all present opponents each of the d days.

In the third sample, Arya will beat his opponents on days 13 and 4 and his opponents will beat him on days 2 and 5. Thus, the maximum number of consecutive winning days is 2, which happens on days 3 and 4.

题意:Arya在学校有n个对手,如果这些对手在一天全部出现,那么Arya将被打败,否则Arya会赢,给出d天对手是否出现的情况(字符0表示不出现,1表示出现)
问Arya最多可以连续几天赢。
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,d,i,j,k,l,flag;
	char a;//本来以为只有0和1,用整数就行,结果一直没输出。。。然后换做字符就行了。 
	while(scanf("%d%d",&n,&d)!=EOF)
	{
		int l=0;
		int Maxx=0;
		for(i=1;i<=d;i++)
		{
			flag=0;
			for(j=1;j<=n;j++)
			{
				cin>>a;
				if(a=='0')
				flag=1;
			}
			if(flag==1)
			l++;
			else
			l=0;
			Maxx=max(Maxx,l);	
		}
		printf("%d\n",Maxx);
	}
	return 0;
}


内容概要:本文详细介绍了软考高项(高级信息系统项目管理师)的备考策略、考试内容及应试技巧。首先,文章强调了二八法则的应用,即80%的时间精力应放在项目管理领域的核心知识点上,如五大过程组、十大知识域等,20%的时间放在IT知识和组织级项目管理上。备考分为三个阶段:基础阶段通过精读教材、绘制思维导图夯实基础;强化阶段通过真题训练、案例分析提升实战能力;冲刺阶段通过论文押题、模拟考试做好最后准备。文章还特别指出,计算题和论文写作是考试的重点和难点,需重点练习。此外,针对不同地区的考生,提供了差异化的备考建议,如一线城市侧重新技术应用,中西部地区关注乡村振兴信息化等。最后,文章提醒考生关注机考模拟系统的开放时间和准考证打印时间,确保顺利参加考试。 适合人群:准备参加软考高项考试的考生,特别是有一定项目管理基础并希望系统复习、提高应试能力的考生。 使用场景及目标:①帮助考生高效利用有限时间,集中精力复习核心知识点;②通过模拟练习和真题训练,提升计算题和论文写作的能力;③结合实际案例,掌握项目管理全流程知识,提高考试通过率。 其他说明:备考过程中,考生应结合自身实际情况,灵活调整学习计划。同时,充分利用各种学习资源,如精讲课视频、直播课、历年真题等,不断巩固和深化对知识点的理解。考试改革后,机考成为主流,考生需提前熟悉机考系统,确保考试时能够熟练操作。
内容概要:本文详细介绍了利用Simulink构建四台永磁同步电机(PMSM)偏差耦合同步控制系统的方法及其优化策略。首先阐述了多电机同步控制在工业自动化中的重要性和应用场景,如AGV小车底盘驱动、传送带协同等。接着深入探讨了偏差耦合控制的具体实现方式,包括环形耦合结构的设计、耦合补偿算法以及PID参数调整方法。文中特别强调了耦合系数的选择对于系统稳定性的影响,并提供了具体的MATLAB函数用于计算各电机之间的耦合补偿量。此外,还讨论了如何通过动态权重分配算法来增强相邻电机间的耦合关系,从而提高同步速度。同时,针对可能出现的问题提出了预防措施,如避免使用微分环节、设置合理的摩擦系数和采样周期等。最后分享了一些实践经验,例如采用在线参数辨识技术和低通滤波器以应对负载突变等情况。 适用人群:从事工业自动化领域的工程师和技术人员,尤其是那些对多电机同步控制感兴趣的读者。 使用场景及目标:适用于需要精确控制多个电机同步运行的场合,如生产线上多轴协调动作、机器人关节控制等。主要目的是确保各个电机能够按照预定的速度平稳地协同工作,减少由于不同步造成的故障风险。 其他说明:文章不仅提供了理论指导,还包括了许多实用的操作技巧和注意事项,有助于读者更好地理解和掌握这一复杂的控制技术。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值