Cod sursa(job #178305)
Utilizator | Albu Alexandru albua | Data | 14 aprilie 2008 13:22:00 |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <stdio.h>
FILE *f,*g;
long long i;
char ok;
long n,temp;
long calcp5(long long x)
{
long k,contor;
k=5;
contor=0;
while(x/k!=0)
{
contor+=x/k;
k*=5;
}
return contor;
}
int main()
{
f=fopen("fact.in","r");
g=fopen("fact.out","w");
fscanf(f,"%lld\n",&n);
i=5;
ok=0;
while(!ok)
{
temp=calcp5(i);
if(temp==n) ok=1;
i++;
}
fprintf(g,"%lld\n",i-1);
fclose(f); fclose(g);
return 0;
}