Cod sursa(job #2488979)
Utilizator | Data | 7 noiembrie 2019 20:46:22 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p,x=5,aux;
fin>>p;
if(!p)
fout<<1;
else{
aux=p;
for(int i=p;i;i++)
{
while(x<=i)
{
aux-=i/x;
x*=5;
}
if(!aux)
{fout<<i;
break;}
x=5;
aux=p;
}
}
}