Cod sursa(job #3312601)

Utilizator razvan3107Ana Razvan-Ioan razvan3107 Data 29 septembrie 2025 10:13:01
Problema Factorial Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.3 kb
#include<iostream>
#include<fstream>
using namespace std;ifstream f("fact.in");ofstream g("fact.out");
int main()
{int P,N,z,d,q;
f>>P;
if ((P>=0)&&(P<=100000000))
{z=P;
N=1;d=2;
while (z)
{N=N*d;q=d;d++;
while (q%5==0)
{q=q/5;z--;}}
g<<d-1;}
else g<<-1;
f.close();g.close();
return 0;}