Description

#169-[模拟]数字方阵#169-[模拟]数字方阵

直接暴力模拟.

#include <iostream>

using namespace std;

int main(void)
{
	int n, m, k, res = 0, i, x, len, count = 0;
	
	scanf("%d%d%d", &n, &m, &k);
	len = (k - 1) * m;
	while (len--)
	{
		scanf("%d", &x);
	}
	for (i = 1; i <= m; ++i)
	{
		scanf("%d", &x);
		if (x) // 是非零数,计算连续数量
		{
			res = max(res, ++count);
		}
		else // 是零,计数器归零
		{
			count = 0;
		}
	}
	
	printf("%d", res);
	
	return 0;
}

 

相关文章:

  • 2021-08-19
  • 2022-12-23
  • 2021-05-21
  • 2021-08-22
  • 2022-01-05
  • 2021-12-04
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
  • 2021-09-28
  • 2022-12-23
相关资源
相似解决方案