Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
672 B
3
Indexable
Never
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a[100][100];
	int i, j, n, m, x, summ = 0;
	cin >> n >> m;
	cin >> x;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			cin >> a[i][j];
		}
	}
	cin >> x;
	i = 0;
	for (j = 0; j < n; j++)
	{
		if (a[i][j] = 0) {
			summ += 1;
		}
		if (summ == x) {
			cout << j;
			break;
		}
		if (a[i][j] != 0) {
			summ = 0;
		}
	}
	if (summ != x) {
		summ = 0;
		j = 0;
		for (i = 0; i < n; i++)
		{
			if (a[i][j] = 0) {
				summ += 1;
			}
			if (summ == x) {
				cout << j;
				break;
			}
			if (a[i][j] != 0) {
				summ = 0;
			}

		}
	}
}