Cod sursa(job #247191)
Utilizator | Adrian Bacircea adytzu2007 | Data | 22 ianuarie 2009 12:43:19 |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <stdio.h>
int p;
FILE *f=fopen("fact.in","r");
FILE *g=fopen("fact.out","w");
inline void citire()
{
fscanf(f,"%d",&p);
}
void afisare(long x)
{
fprintf(g,"%ld",x);
}
void solve()
{
long i=0,g=0,aux;
while (g<p)
{
i++;
aux=i;
while (aux%5==0) {g++;aux=aux/5;}
}
afisare(i);
}
int main()
{
citire();
solve();
fclose(f);
fclose(g);
return 0;
}