Cod sursa(job #246552)

Utilizator Soimul_NegruIon Popescu Soimul_Negru Data 21 ianuarie 2009 08:54:03
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.25 kb
#include <fstream.h>
int main()
{int j,n=1,x=0;
long p;

ifstream f("fact.in");
f>>p;
f.close();

while(x<p)
 {n++;
  j=n;
  while(j%5==0)
   {j=j/5; x++;}}

ofstream g("fact.out");
if(x==p) g<<n;
else g<<-1;
g.close();

return 0;
}