Cod sursa(job #1656125)

Utilizator Stefan_ZotaStefan Zota Stefan_Zota Data 18 martie 2016 19:27:59
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream>
using namespace std;
int P,cn,n,p5;
int main()
{ ifstream f("fact.in");
  ofstream g("fact.out");
  f>>P;
  if(P==0)
    g<<1;
   else {n=0;
         while(p5<P)
          {n=n+5;
           cn=n;
          while (cn%5==0)
          {p5=p5+1;
           cn=cn/5;}
           }
          if(p5>P)
             g<<-1;
             else g<<n;}


          ;


    return 0;
}