Cod sursa(job #908676)
Utilizator | Data | 9 martie 2013 21:45:35 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<stdio.h>
using namespace std;
long int p,i=5,s=1,putere,x;
int main()
{
FILE*f=fopen("fact.in","r");
FILE*g=fopen("fact.out","w");
fscanf(f,"%d",&p);
while(s<p)
{ i+=5;x=i;
while((x>1)&&(x%5==0))
{s++;x=x/5;}
}
if(s==p) fprintf(g,"%d",i);
else fprintf(g,"-1");
fclose(f);
fclose(g);
return 0;
}