Cod sursa(job #1366692)

Utilizator stefzahZaharia Stefan Tudor stefzah Data 1 martie 2015 13:01:49
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
long long p,n,log5,v1,i,v2,s,j,s1[15],x,k,y,r,ct;
int main()
{fin>>p;
 n=0;
 while(p>0)
      {n=n+5;
       ct=0;
       j=n;
       while(j%5==0)
            {ct++;
             j=j/5;
            }
       p=p-ct;
      }
 fout<<n;
}