Cod sursa(job #420389)
Utilizator | Data | 18 martie 2010 22:48:29 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.26 kb |
#include <fstream.h>
int p,i=0,h,s,aux;
int main()
{ifstream f("fact.in");ofstream g("fact.out");f>>p;
if(p==0) g<<"-1";
else
{while(s==0 && h<=p)
{i=i+5;aux=i;h=0;
while(aux!=0)
{h=h+aux/5;aux=aux/5;}
if(h==p) s=1;}
if(s==0) g<<"-1";
else g<<i;}
return 0;}