#1826
Să se scrie o funcție C++ care să returneze pentru un număr natural n transmis ca parametru numărul de cifre zero de la finalul lui n! = 1•2•...•n.
| Problema | ZeroF | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64608493 | Utilizator | |
| Fișier | zerof.cpp | Dimensiune | 460 B |
| Data încărcării | 18 Mai 2026, 13:46 | Scor/rezultat | Eroare de compilare |
zerof.cpp:8:12: error: ‘nr’ was not declared in this scope 8 | ifstream f(nr.txt); | ^~ zerof.cpp:9:12: error: ‘bac’ was not declared in this scope 9 | ofstream g(bac.txt); | ^~~ zerof.cpp:11:12: error: ‘int f(int)’ redeclared as different kind of entity 11 | int f(int n) | ^ zerof.cpp:8:10: note: previous declaration ‘std::ifstream f’ 8 | ifstream f(nr.txt); | ^ zerof.cpp: In function ‘int f(int)’: zerof.cpp:17:15: error: no match for call to ‘(std::ifstream {aka std::basic_ifstream<char>}) (int)’ 17 | return 4*f(n-1) -3* f(n-2) - 2* f(n-3) | ~^~~~~ zerof.cpp:17:26: error: no match for call to ‘(std::ifstream {aka std::basic_ifstream<char>}) (int)’ 17 | return 4*f(n-1) -3* f(n-2) - 2* f(n-3) | ~^~~~~ zerof.cpp:17:38: error: no match for call to ‘(std::ifstream {aka std::basic_ifstream<char>}) (int)’ 17 | return 4*f(n-1) -3* f(n-2) - 2* f(n-3) | ~^~~~~ zerof.cpp:17:43: error: expected ‘;’ before ‘}’ token 17 | return 4*f(n-1) -3* f(n-2) - 2* f(n-3) | ^ | ; 18 | } | ~ zerof.cpp: In function ‘void scrie(int, int)’: zerof.cpp:22:10: error: no match for call to ‘(std::ifstream {aka std::basic_ifstream<char>}) (int&)’ 22 | x = f(k); | ~^~~ zerof.cpp: In function ‘int main()’: zerof.cpp:33:15: error: expected ‘;’ before ‘}’ token 33 | scrie(1,z) | ^ | ; 34 | 35 | } | ~ zerof.cpp: At global scope: zerof.cpp:38:5: error: redefinition of ‘int main()’ 38 | int main(){ | ^~~~ zerof.cpp:29:5: note: ‘int main()’ previously defined here 29 | int main() | ^~~~ zerof.cpp: In function ‘int main()’: zerof.cpp:41:25: error: ‘zerof’ was not declared in this scope 41 | cout << zerof(x) << endl; | ^~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ZeroF 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ă.