#1015
Se consideră un șir cu n elemente, numere naturale. Folosind metoda Divide et Impera, determinați suma elementelor acestui șir.
| Problema | SumVec | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64069893 | Utilizator | |
| Fișier | sumvec.cpp | Dimensiune | 474 B |
| Data încărcării | 15 Aprilie 2026, 13:16 | Scor/rezultat | Eroare de compilare |
sumvec.cpp:6:1: error: expected initializer before ‘int’ 6 | int main() | ^~~ sumvec.cpp: In function ‘int suma_DI(int, int)’: sumvec.cpp:21:1: error: expected primary-expression before ‘}’ token 21 | } | ^ sumvec.cpp:14:9: warning: unused variable ‘m’ [-Wunused-variable] 14 | int m,s1,s2; | ^ sumvec.cpp:14:11: warning: unused variable ‘s1’ [-Wunused-variable] 14 | int m,s1,s2; | ^~ sumvec.cpp:14:14: warning: unused variable ‘s2’ [-Wunused-variable] 14 | int m,s1,s2; | ^~ sumvec.cpp: At global scope: sumvec.cpp:22:5: error: ‘m’ does not name a type; did you mean ‘tm’? 22 | m=(p+q)/2; | ^ | tm sumvec.cpp:23:5: error: ‘s1’ does not name a type 23 | s1=suma_DI(p,m); | ^~ sumvec.cpp:24:5: error: ‘s2’ does not name a type 24 | s2=suma_DI(m+1,q); | ^~ sumvec.cpp:25:5: error: expected unqualified-id before ‘return’ 25 | return s1+s2; | ^~~~~~ sumvec.cpp:27:1: error: expected declaration before ‘}’ token 27 | } | ^ sumvec.cpp: In function ‘int main()’: sumvec.cpp:30:5: error: ‘citire’ was not declared in this scope; did you mean ‘ctime’? 30 | citire(v,n); | ^~~~~~ | ctime sumvec.cpp: In function ‘int suma_DI(int, int)’: sumvec.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type] 21 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumVec 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ă.