Cod sursa(job #179003)
Utilizator | Data | 15 aprilie 2008 14:37:48 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream.h>
ifstream f("fact.in");
ofstream g("fact.out");
main()
{
long a,p,i,sw=0,k;
f>>p;
i=0;
k=0;
if (p==0)
g<<1;
else
{
while (sw==0 && p>=k)
{
i=i+5;
a=i;
while (a%5==0)
{
k++;
a=a/5;
}
if (k==p)
sw=1;
}
if (sw==1)
g<<i;
else
g<<"-1";
}
f.close();
g.close();
}