#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 | #64316887 | Utilizator | |
| Fișier | matrdivimp1.cpp | Dimensiune | 306 B |
| Data încărcării | 29 Aprilie 2026, 12:13 | Scor/rezultat | Eroare de compilare |
matrdivimp1.cpp: In function ‘int DI(int*, int, int)’: matrdivimp1.cpp:6:6: error: expected ‘(’ before ‘v’ 6 | { if v[st]%2==0) | ^ | ( matrdivimp1.cpp:8:2: error: expected ‘}’ before ‘else’ 8 | else return 0; | ^~~~ matrdivimp1.cpp:6:1: note: to match this ‘{’ 6 | { if v[st]%2==0) | ^ matrdivimp1.cpp: At global scope: matrdivimp1.cpp:10:9: error: ‘st’ was not declared in this scope; did you mean ‘std’? 10 | int m=(st+dr)/2; | ^~ | std matrdivimp1.cpp:10:12: error: ‘dr’ was not declared in this scope 10 | int m=(st+dr)/2; | ^~ matrdivimp1.cpp:11:2: error: expected unqualified-id before ‘return’ 11 | return DI(v,st,m)+DI(v,m+1,dr); | ^~~~~~ matrdivimp1.cpp:12:1: error: expected declaration before ‘}’ token 12 | } | ^ matrdivimp1.cpp: In function ‘int main()’: matrdivimp1.cpp:15:8: error: ‘n’ was not declared in this scope 15 | { cin>>n>>m; | ^ matrdivimp1.cpp:16:7: error: ‘i’ was not declared in this scope 16 | {for(i=1;i<=m*n;i++) | ^ matrdivimp1.cpp:19:3: error: expected ‘}’ at end of input 19 | } | ^ matrdivimp1.cpp:15:1: note: to match this ‘{’ 15 | { cin>>n>>m; | ^ matrdivimp1.cpp: In function ‘int DI(int*, int, int)’: matrdivimp1.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
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ă.