a

mail@pastecode.io avatar
unknown
plain_text
2 years ago
609 B
2
Indexable
Never
#include<iostream>
using namespace std;

struct MATRIX{
    int m; // dong
    int n; // cot
    int list[m][n];
};

int timNhieuChan(MATRIX m) {
	int index = 0;
	int max = 0;
	bool flag = 0; // thay bool flag = false;
	for (int i = 0; i < m.m; i++)
	{
		int count = 0;
		for (int j = 0; j < m.n; j++)
		{
			if (m.list[i][j] < 0) {
				if (!flag) { 
					index = i;
					max = count;
					flag = 1;
				}
				else if (count > max) {
					count++;
					index = i;
					max = count;
				}
			}
		}
	}

	return flag == 0 ? -1 : index;
}

int main(){
    MATRIX maTran;
    maTran.m = 3;
    maTran.n = 3;
    
}