Cod sursa(job #605849)
Utilizator | Data | 2 august 2011 14:33:44 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <fstream.h>
fstream f("fact.in");
ofstream g("fact.out");
int main()
{
int p;
f>>p;
int i=0,n=4*p,x=n;
while((n++)%5!=0);
n--;
while(i<p)
{
i=0;
x=n;
while(x>0)
{
x=x/5;
i+=x;
}
n+=5;
}
if(i==p)
g<<(n-5);
else
g<<-1;
f.close();
g.close();
return 0;
}