#766
Se dă o matrice cu n linii şi m coloane şi elemente numere naturale. Determinați indicele liniei care conține număr maxim de elemente pare. Dacă există mai multe linii cu număr maxim de elemente pare, se vor afișa toți indicii, în ordine crescătoare.
| Problema | NrPare | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64922476 | Utilizator | |
| Fișier | nrpare.cpp | Dimensiune | 704 B |
| Data încărcării | 14 Iunie 2026, 12:00 | Scor/rezultat | Eroare de compilare |
nrpare.cpp: In function ‘int main()’: nrpare.cpp:9:14: error: expected initializer before ‘a’ 9 | int n, m a[N][N]; | ^ nrpare.cpp:10:17: error: ‘m’ was not declared in this scope 10 | cin >> n >> m; | ^ nrpare.cpp:14:24: error: ‘a’ was not declared in this scope 14 | cin >> a[i][j]; | ^ nrpare.cpp:22:14: error: ‘a’ was not declared in this scope 22 | if (a[i][j] % 2 == 0) | ^ nrpare.cpp:21:6: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 21 | for ( int j = 0; j < m; j++) | ^~~ nrpare.cpp:25:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 25 | if (cnt > mx) | ^~ nrpare.cpp:33:13: error: ‘a’ was not declared in this scope 33 | if(a[i][j] % 2 ==0) | ^ nrpare.cpp:32:6: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 32 | for (int j = 0; j < m; j++) | ^~~ nrpare.cpp:36:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 36 | if(cnt == mx) | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrPare face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.