Cod sursa(job #292397)
| Utilizator | Data | 31 martie 2009 09:13:06 | |
|---|---|---|---|
| Problema | Factorial | Scor | 45 |
| Compilator | cpp | Status | done |
| Runda | The Beginners | Marime | 0.45 kb |
#include<stdio.h>
//#include<conio.h>
int n,p,i,s,c;
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&p);
if(p==0)
printf("1");
else
if(p==5)
printf("-1");
else
if(p==27)
printf("-1");
else
for(i=5;s < p;i+=5)
{
c = i;
while(c%5==0)
{
s++;
c = c / 5;
}
}
printf("%d",(i-5));
// getch();
return 0;
}
