はまやんはまやんはまやん

hamayanhamayan's blog

Opponents [Codeforces 360 : Div2 A]

問題

http://codeforces.com/contest/688/problem/A

n人の参加者がいて、d日分の参加・非参加状況が与えられる。
全ての参加者が連続で参加する日は最長何日間か。

1 <= n,d <= 100

思考の流れ

1. 本当にやるだけ

解法

http://codeforces.com/contest/688/submission/18787599

int n, d;
string opp[100];
//-----------------------------------------------------------------
int main() {
	scanf("%d %d", &n, &d);
	rep(i, 0, d) cin >> opp[i];

	int ans = 0;
	int cnt = 0;
	rep(i, 0, d) {
		int c = 0;
		rep(j, 0, n) if (opp[i][j] == '1') c++;
		if (c == n) {
			ans = max(ans, cnt);
			cnt = 0;
		}
		else
			cnt++;
	}
	ans = max(ans, cnt);

	printf("%d\n", ans);
}