题目链接:http://codeforces.com/problemset/problem/688/A
题意分析:一个人有n个对手,某天一旦有一个对手没出席他将打败所有对手,否则他将被打败。求在d天他有多少天是连续打败所有对手的。
题目比较简单,直接上代码。
#include<cstdio>
#include<string>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<cstring>
#include<set>
#include<queue>
const int maxn = 1000000000;
using namespace std;
int main()
{
int n,d;
int ans = 0;
scanf("%d%d",&n,&d);
char ch;
getchar();
int num = 0;
for(int i = 1; i <= d; i++)
{
int flag = 0;
for(int j = 1; j <= n; j++)
{
scanf("%c",&ch);
// cout << "ch == " << ch << endl;
if(ch == '0')
{
flag = 1;
}
}
if(flag)
{
num++;
}
if(i == d || !flag) {ans = max(ans, num); num = 0;}
int chh = getchar();//接受每行后面的换行符
}
printf("%d\n",ans);
return 0;
}