#1015
SumVec
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 | #53438765 | Utilizator | |
Fișier | sumvec.cpp | Dimensiune | 480 B |
Data încărcării | 30 Octombrie 2024, 16:37 | Scor / rezultat | Eroare de compilare |
sumvec.cpp:7:23: error: new declaration 'int div(int, int)' int div(int st, int dr); ^ In file included from /usr/include/c++/4.8/cstdlib:72:0, from /usr/include/c++/4.8/ext/string_conversions.h:41, from /usr/include/c++/4.8/bits/basic_string.h:2815, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sumvec.cpp:1: /usr/include/stdlib.h:789:14: error: ambiguates old declaration 'div_t div(int, int)' extern div_t div (int __numer, int __denom) ^ sumvec.cpp: In function 'int main()': sumvec.cpp:14:6: error: cannot convert 'div_t' to 'int' in assignment s=div(1, n); ^ sumvec.cpp: In function 'int div(int, int)': sumvec.cpp:20:23: error: new declaration 'int div(int, int)' int div(int st, int dr) ^ In file included from /usr/include/c++/4.8/cstdlib:72:0, from /usr/include/c++/4.8/ext/string_conversions.h:41, from /usr/include/c++/4.8/bits/basic_string.h:2815, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sumvec.cpp:1: /usr/include/stdlib.h:789:14: error: ambiguates old declaration 'div_t div(int, int)' extern div_t div (int __numer, int __denom) ^ sumvec.cpp:31:27: error: cannot convert 'div_t' to 'int' in initialization int k1=div(st, mij); ^ sumvec.cpp:32:30: error: cannot convert 'div_t' to 'int' in initialization int k2=div(mij+1 , dr); ^ sumvec.cpp:32:13: warning: unused variable 'k2' [-Wunused-variable] int k2=div(mij+1 , dr); ^
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ă.