Cod sursa(job #417983)
Utilizator | Data | 15 martie 2010 11:37:59 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<stdio.h>
int P,p,x,nr;
FILE *in=fopen("fact.in","rt"),*out=fopen("fact.out","wt");
int main()
{
fscanf(in,"%d",&P);
for(;;)
{
nr+=5;
x=nr;
if(p!=P)
{
if(x%5==0)
while(x%5==0)
{
p++;
x/=5;
}
}
else
break;
}
if(P==0)
fprintf(out,"1");
else
fprintf(out,"%d",nr-5);
return 0;
}