Cod sursa(job #1273019)

Utilizator tudor00Stoiean Tudor tudor00 Data 22 noiembrie 2014 14:45:51
Problema Factorial Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>

using namespace std;

int main()
{
    ifstream in("fact.in");
    ofstream out("fact.out");
    int nr0,n,m,s=0;
    in>>nr0;
    n=nr0*4;
    while(s<nr0)
        {
            s=0;
            m=n;
            while(m!=0)
            {
                m=m/5;
                s=s+m;
            }
            n++;
        }
    if(s!=nr0)
        {
            out<<-1;
        }else
        {
            if(nr0==0)
                out<<1;
else
    out<<n-1;
        }
   return 0;
}