Implementati o functie care primeste o matrice cu r linii si c coloane de numere intregi si intoarce diferenta dintre suma maxima si suma minima dintre sumele liniilor.
Semnatura subprogramului (implementati exact aceasta functie/procedura - numele, parametrii, ordinea si tipul returnat trebuie sa coincida):
- C++:
int diferentaSumeLinii(int r, int c, vector<vector<int>> m) - C:
int diferentaSumeLinii(int r, int c, int m[][205]) - Pascal:
function diferentaSumeLinii(r: integer; c: integer; m: TIntMatrix): integer - Python:
def diferentaSumeLinii(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
- Diferenta dintre suma maxima si suma minima a liniilor.
- Restrictii
- 1 <= r, c <= 100, |m[i][j]| <= 1000
Exemple
Exemplul 1
Intrare
2 2 1 2 3 4
Iesire
4
Exemplul 2
Intrare
1 1 5
Iesire
0

