Cod sursa(job #154422)
Utilizator | Data | 11 martie 2008 10:32:27 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include<stdio.h>
long int p,k;
int n,x;
int main()
{freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%ld",&n);
if(p==0)
printf("%d",1);
else
{n=5;
k=0;
while(k<p)
{x=n;
while(x%5==0)
{
k++;
x/=5;
}
n+=5;
}
if(k!=p)
printf("%d",-1);
else
printf("%ld\n",n-5);
}
return 0;
}