#821
Să se scrie o funcție C++ recursivă care returnează cel mai mare divizor comun a două numere transmise ca parametri.
| Problema | CmmdcRec | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64217648 | Utilizator | |
| Fișier | cmmdcrec.cpp | Dimensiune | 194 B |
| Data încărcării | 23 Aprilie 2026, 13:13 | Scor/rezultat | Eroare de compilare |
cmmdcrec.cpp: In function ‘int cmmmdc(int, int)’: cmmdcrec.cpp:11:16: error: ‘cmmdc’ was not declared in this scope; did you mean ‘cmmmdc’? 11 | return cmmdc(n-m,m) | ^~~~~ | cmmmdc cmmdcrec.cpp:11:28: error: expected ‘;’ before ‘if’ 11 | return cmmdc(n-m,m) | ^ | ; 12 | if(n<m) | ~~ cmmdcrec.cpp:10:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 10 | if(n>m) | ^~ cmmdcrec.cpp:12:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 12 | if(n<m) | ^~ cmmdcrec.cpp:13:16: error: ‘cmmdc’ was not declared in this scope; did you mean ‘cmmmdc’? 13 | return cmmdc(n,m-n) | ^~~~~ | cmmmdc cmmdcrec.cpp:13:28: error: expected ‘;’ before ‘}’ token 13 | return cmmdc(n,m-n) | ^ | ; 14 | } | ~ cmmdcrec.cpp: In function ‘int main()’: cmmdcrec.cpp:19:25: error: ‘cmmdc’ was not declared in this scope; did you mean ‘cmmmdc’? 19 | cout << cmmdc(x , y) << endl; | ^~~~~ | cmmmdc
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CmmdcRec face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.