Cod sursa(job #1524944)

Utilizator ionut98Bejenariu Ionut Daniel ionut98 Data 14 noiembrie 2015 16:23:00
Problema Factorial Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long p,n,m,s;
int main()
{
    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;
return 0;}