Cod sursa(job #645662)
| Utilizator | Data | 10 decembrie 2011 02:59:28 | |
|---|---|---|---|
| Problema | Factorial | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<stdio.h>
#include<math.h>
long int nr_zerouri(long int x)
{
long int aux=x,suma=0;
while(x!=0)
{
suma+=x%5;
x=x/5;
}
return (aux-suma)/4;
}
int main()
{
long int i,cerinta,P;
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&P);
if(P==0)
printf("1");
else
{
cerinta=P;
P=4*P;
while(P%5!=0)
P++;
i=P;
for(i=P;i;i+=5)
if(nr_zerouri(i)==cerinta)
{printf("%d",i);break;}
}
return 0;
}