Cod sursa(job #417989)
Utilizator | Data | 15 martie 2010 11:42:43 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<stdio.h>
int P,p,x,nr=-5;
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)
{
while(x%5==0)
{
p++;
x/=5;
}
}
else
break;
}
if(P==0)
fprintf(out,"1");
else
fprintf(out,"%d",nr);
return 0;
}