Cod sursa(job #330131)

Utilizator cosmyoPaunel Cosmin cosmyo Data 8 iulie 2009 20:55:32
Problema Factorial Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include<fstream.h>
long aux,p,n,i,j;
int main()
{ifstream fin("fact.in");
 fin>>p;
 n=0;
 i=0;
 while(i<p)
 {n+=5;
  aux=n;
  j=0;
  while(aux%5==0)
  {j++;
   aux/=5;
  }
  i+=j;
 }
 ofstream fout("fact.out");
 if(i==p)
 fout<<n;
 else
	 fout<<-1;
 fout.close();
 fin.close();
 return 0;
}