Cod sursa(job #858599)
Utilizator | Data | 19 ianuarie 2013 01:23:16 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream>
using namespace std;
fstream f("fact.in" ,ios::in), g("fact.out", ios::out);
int main()
{
unsigned long long p,nr,aux,t;
f>>p;
if(p==1)
g<<"0";
else
{
nr=5;
t=1;
while (t<p)
{
nr+=5;
aux=nr;
while (aux%5==0)
{
aux/=5;
t++;
}
}
g<<nr;
}
return 0;
}