#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 | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51260569 | Utilizator | |
Fișier | cmmdc3.cpp | Dimensiune | 683 B |
Data încărcării | 02 Iunie 2024, 22:19 | 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)': cmmdc3.cpp:12:16: error: 'v' was not declared in this scope return v[st]; ^ cmmdc3.cpp:15:31: error: 'cmmds' was not declared in this scope int jum1=cmmds(st, mij); ^ cmmdc3.cpp:18:15: error: 'v' was not declared in this scope while(v[mij+1] != 0){ ^ 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(st, mij); ^ cmmdc3.cpp:16:13: warning: unused variable 'jum2' [-Wunused-variable] int jum2=cmmdc(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)': 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ă.