#926
Scrieți definiția completă unui subprogram C++ recursiv care returnează suma elementelor divizibile cu 3 ale unui tablou unidimensional transmis ca parametru.
| Problema | FSumDiv3Rec | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64679046 | Utilizator | |
| Fișier | fsumdiv3rec.cpp | Dimensiune | 154 B |
| Data încărcării | 22 Mai 2026, 10:36 | Scor/rezultat | 0 puncte |
In function ‘int sum3(int*, int)’, inlined from ‘int main()’ at fsumdiv3rec.cpp:19:19: fsumdiv3rec.cpp:8:25: warning: array subscript -1 is outside array bounds of ‘int [100]’ [-Warray-bounds=] 8 | if(v[n-1] % 3 == 0) | ~~~~~^ fsumdiv3rec.cpp: In function ‘int main()’: fsumdiv3rec.cpp:15:16: note: at offset -4 into object ‘v’ of size 400 15 | int n, v[100]; | ^
| 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.002 secunde | Raspuns gresit. | 20 | 0 | ||
| 4 | 0.002 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 FSumDiv3Rec 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ă.