Cod sursa(job #459390)
| Utilizator | Data | 29 mai 2010 15:33:32 | |
|---|---|---|---|
| Problema | Factorial | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.74 kb |
#include <cstdio>
#define infile "fact.in"
#define outfile "fact.out"
long long P,N,nr5,nr2;
long long minim(long long x,long long y)
{
if(x<y)
return x;
return y;
}
void solve()
{
long long i,aux;
for(i=1;nr5<P;i++)
{
aux=i;
while(aux%5==0)
{
nr5++;
aux/=5;
}
}
if(nr5==P)
N=i-1;
else
N=-1;
if(P==0)
N=1;
}
int main()
{
freopen(infile,"r",stdin);
freopen(outfile,"w",stdout);
scanf("%lld",&P);
solve();
printf("%lld\n",N);
fclose(stdin);
fclose(stdout);
return 0;
}
