Cod sursa(job #246555)

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

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

while(x<p)
 {n=n+5;
  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;
}