#1023
Cmmdc3
Se dă un sir cu n
elemente, numere naturale nenule. Folosind metoda Divide et Impera, determinaţi cel mai mare divizor comun al elementelor acestui șir.
Problema | Cmmdc3 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51260586 | Utilizator | |
Fișier | cmmdc3.cpp | Dimensiune | 696 B |
Data încărcării | 02 Iunie 2024, 22:20 | Scor / rezultat | Eroare de compilare |
cmmdc3.cpp: In function 'int max(int, int)': cmmdc3.cpp:8:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ cmmdc3.cpp: In function 'int cmmdc(int*, int, int)': cmmdc3.cpp:15:33: error: 'cmmds' was not declared in this scope int jum1=cmmds(v,st, mij); ^ cmmdc3.cpp:19:38: error: expected ',' or ';' before ']' token int X = v[mij] % v[mij+1]]; ^ cmmdc3.cpp:23:16: error: 'X' was not declared in this scope return X; ^ cmmdc3.cpp:15:13: warning: unused variable 'jum1' [-Wunused-variable] int jum1=cmmds(v,st, mij); ^ cmmdc3.cpp:16:13: warning: unused variable 'jum2' [-Wunused-variable] int jum2=cmmdc(v,mij+1, dr); ^ cmmdc3.cpp: In function 'int main()': cmmdc3.cpp:37:23: error: no matching function for call to 'max(int&, <unresolved overloaded function type>)' max(i, max) = ^ cmmdc3.cpp:37:23: note: candidates are: cmmdc3.cpp:4:5: note: int max(int, int) int max(int x, int max){ ^ cmmdc3.cpp:4:5: note: no known conversion for argument 2 from '<unresolved overloaded function type>' to 'int' In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cmmdc3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: cmmdc3.cpp:37:23: note: candidate expects 3 arguments, 2 provided max(i, max) = ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cmmdc3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int] max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const int&' cmmdc3.cpp:38:3: error: expected primary-expression before '}' token } ^ cmmdc3.cpp:38:3: error: expected ';' before '}' token cmmdc3.cpp: In function 'int cmmdc(int*, int, int)': cmmdc3.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cmmdc3 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ă.