Cod sursa(job #1110959)

Utilizator geo.calin32Calin George geo.calin32 Data 18 februarie 2014 15:22:34
Problema Factorial Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{long p,n,m,s=0;// p=nr de zerouri n = nr cautat
ifstream ("fact.in");
ofstream("fact.out");
f>>p;
n=p*4;
while(s<p)
{s=0;
m=n;
while(m!=0)
{m=m/5;
s=s+m;}
n++;
}
if(s!=p)
    g<<-1;
else
    if(p==0) g<<1;
else
g<<n-1;
f.close();
g.close();
return 0;}