Implementati o functie care primeste o matrice cu r linii si c coloane de numere intregi si intoarce cate dintre elemente sunt strict negative.
Semnatura subprogramului (implementati exact aceasta functie/procedura - numele, parametrii, ordinea si tipul returnat trebuie sa coincida):
- C++:
int numarulElementelorNegative(int r, int c, vector<vector<int>> m) - C:
int numarulElementelorNegative(int r, int c, int m[][205]) - Pascal:
function numarulElementelorNegative(r: integer; c: integer; m: TIntMatrix): integer - Python:
def numarulElementelorNegative(r, c, m):
- Date de intrare
- Pe prima linie r si c. Urmeaza r linii, fiecare cu c numere intregi separate prin spatiu.
- Date de iesire
- Numarul elementelor strict negative.
- Restrictii
- 1 <= r, c <= 100, |m[i][j]| <= 1000
Exemple
Exemplul 1
Intrare
2 2 1 -2 -3 4
Iesire
2
Exemplul 2
Intrare
1 1 -5
Iesire
1

