#1862
Să se scrie o funcție C++ recursivă cu trei parametri n, k, c, care primește prin parametrul n un număr natural, prin parametrul k o cifră și întoarce prin parametrul c numărul de cifre ale lui n care sunt mai mari sau egale decât k.
| Problema | CntCifKRec | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64968398 | Utilizator | |
| Fișier | cntcifkrec.cpp | Dimensiune | 221 B |
| Data încărcării | 28 Iunie 2026, 13:52 | Scor/rezultat | 0 puncte |
In function ‘void cnt_cif(int, int, int&)’, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6: cntcifkrec.cpp:18:20: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 18 | c=1+s; | ~^~ cntcifkrec.cpp: In function ‘void cnt_cif(int, int, int&)’: cntcifkrec.cpp:6:9: note: ‘s’ was declared here 6 | int s; | ^ In function ‘void cnt_cif(int, int, int&)’, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6: cntcifkrec.cpp:20:18: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 20 | c=s; | ~^~ cntcifkrec.cpp: In function ‘void cnt_cif(int, int, int&)’: cntcifkrec.cpp:6:9: note: ‘s’ was declared here 6 | int s; | ^ In function ‘void cnt_cif(int, int, int&)’, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘int main()’ at cntcifkrec.cpp:28:13: cntcifkrec.cpp:18:20: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 18 | c=1+s; | ~^~ cntcifkrec.cpp: In function ‘int main()’: cntcifkrec.cpp:6:9: note: ‘s’ was declared here 6 | int s; | ^ In function ‘void cnt_cif(int, int, int&)’, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘int main()’ at cntcifkrec.cpp:28:13: cntcifkrec.cpp:18:20: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 18 | c=1+s; | ~^~ cntcifkrec.cpp: In function ‘int main()’: cntcifkrec.cpp:6:9: note: ‘s’ was declared here 6 | int s; | ^ In function ‘void cnt_cif(int, int, int&)’, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:16:12, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘int main()’ at cntcifkrec.cpp:28:13: cntcifkrec.cpp:18:20: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 18 | c=1+s; | ~^~ cntcifkrec.cpp: In function ‘int main()’: cntcifkrec.cpp:6:9: note: ‘s’ was declared here 6 | int s; | ^ In function ‘void cnt_cif(int, int, int&)’, inlined from ‘void cnt_cif(int, int, int&)’ at cntcifkrec.cpp:4:6, inlined from ‘int main()’ at cntcifkrec.cpp:28:13: cntcifkrec.cpp:18:20: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 18 | c=1+s; | ~^~ cntcifkrec.cpp: In function ‘int main()’: cntcifkrec.cpp:6:9: note: ‘s’ was declared here 6 | int s; | ^ cntcifkrec.cpp:29:21: warning: ‘c’ may be used uninitialized [-Wmaybe-uninitialized] 29 | cout << c << endl; | ^ cntcifkrec.cpp:26:19: note: ‘c’ was declared here 26 | int x, k ,c; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 20 | 0 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CntCifKRec 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ă.