Cod sursa(job #218336)

Utilizator funkydvdIancu David Traian funkydvd Data 1 noiembrie 2008 16:54:34
Problema Factorial Scor 55
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.28 kb
#include <fstream>
using namespace std;
ifstream f1 ("fact.in");
ofstream f2 ("fact.out");
int main()
{
long  n,p,q,m;
f1>>p; f1.close();
n=0;
while (p>0)
 {n=n+5;
  q=0;
  m=n;
    while (m%5==0) {q++; m/=5;}
  p=p-q;}
if (p==0) f2<<n;
 else f2<<"-1";f2.close();
}