#3165
Se consideră o matrice cu m linii și n coloane, numere naturale. Folosind metoda Divide et Impera, determinați suma numerelor pare din matrice.
| Problema | MatrDivImp1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64884051 | Utilizator | |
| Fișier | matrdivimp1.cpp | Dimensiune | 930 B |
| Data încărcării | 09 Iunie 2026, 13:25 | Scor/rezultat | Eroare de compilare |
matrdivimp1.cpp: In function ‘void afisare(int (*)[100], int, int)’: matrdivimp1.cpp:15:15: error: ‘a’ was not declared in this scope 15 | cout<<a[i][j]<<" ";<<endl; | ^ matrdivimp1.cpp:14:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 14 | for(int j=1;j<=n;j++) | ^~~ matrdivimp1.cpp:15:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 15 | cout<<a[i][j]<<" ";<<endl; | ^~ matrdivimp1.cpp:15:28: error: expected primary-expression before ‘<<’ token matrdivimp1.cpp: In function ‘int suma(int (*)[100], int, int, int, int)’: matrdivimp1.cpp:22:9: error: ‘l1’ was not declared in this scope 22 | if (l1 > l2 || c1 > c2) return 0; | ^~ matrdivimp1.cpp:22:14: error: ‘l2’ was not declared in this scope 22 | if (l1 > l2 || c1 > c2) return 0; | ^~ matrdivimp1.cpp:22:20: error: ‘c1’ was not declared in this scope; did you mean ‘cs’? 22 | if (l1 > l2 || c1 > c2) return 0; | ^~ | cs matrdivimp1.cpp:22:25: error: ‘c2’ was not declared in this scope; did you mean ‘cs’? 22 | if (l1 > l2 || c1 > c2) return 0; | ^~ | cs matrdivimp1.cpp:24:12: error: ‘a’ was not declared in this scope 24 | if(a[rs][cs]%2==0) return a[rs][cs]; | ^ matrdivimp1.cpp:30:21: error: invalid conversion from ‘int’ to ‘int (*)[100]’ [-fpermissive] 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ^~ | | | int matrdivimp1.cpp:30:20: error: too few arguments to function ‘int suma(int (*)[100], int, int, int, int)’ 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ~~~~^~~~~~~~~~~~~~~~~ matrdivimp1.cpp:20:5: note: declared here 20 | int suma(int v[100][100], int rs, int rj, int cs, int cj) | ^~~~ matrdivimp1.cpp:30:43: error: invalid conversion from ‘int’ to ‘int (*)[100]’ [-fpermissive] 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ^~ | | | int matrdivimp1.cpp:30:42: error: too few arguments to function ‘int suma(int (*)[100], int, int, int, int)’ 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ~~~~^~~~~~~~~~~~~~~~~~~ matrdivimp1.cpp:20:5: note: declared here 20 | int suma(int v[100][100], int rs, int rj, int cs, int cj) | ^~~~ matrdivimp1.cpp:30:71: error: invalid conversion from ‘int’ to ‘int (*)[100]’ [-fpermissive] 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ~~~~^~ | | | int matrdivimp1.cpp:30:66: error: too few arguments to function ‘int suma(int (*)[100], int, int, int, int)’ 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ~~~~^~~~~~~~~~~~~~~~~~~ matrdivimp1.cpp:20:5: note: declared here 20 | int suma(int v[100][100], int rs, int rj, int cs, int cj) | ^~~~ matrdivimp1.cpp:30:95: error: invalid conversion from ‘int’ to ‘int (*)[100]’ [-fpermissive] 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ~~~~^~ | | | int matrdivimp1.cpp:30:90: error: too few arguments to function ‘int suma(int (*)[100], int, int, int, int)’ 30 | return suma(rs,mijr,cs,mijc)+suma(rs,mijr,mijc+2,cj)+suma(mijr+1,rj,cs,mijc)+suma(mijr+1,rj,mijc+1,cj); | ~~~~^~~~~~~~~~~~~~~~~~~~~ matrdivimp1.cpp:20:5: note: declared here 20 | int suma(int v[100][100], int rs, int rj, int cs, int cj) | ^~~~ matrdivimp1.cpp: In function ‘int main()’: matrdivimp1.cpp:41:20: error: ‘a’ was not declared in this scope 41 | cin >> a[i][j]; | ^ matrdivimp1.cpp:43:18: error: invalid conversion from ‘int’ to ‘int (*)[100]’ [-fpermissive] 43 | cout << suma(1, m, 1, n); | ^ | | | int matrdivimp1.cpp:43:17: error: too few arguments to function ‘int suma(int (*)[100], int, int, int, int)’ 43 | cout << suma(1, m, 1, n); | ~~~~^~~~~~~~~~~~ matrdivimp1.cpp:20:5: note: declared here 20 | int suma(int v[100][100], int rs, int rj, int cs, int cj) | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MatrDivImp1 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ă.