Cod sursa(job #246563)
| Utilizator | Data | 21 ianuarie 2009 09:08:05 | |
|---|---|---|---|
| Problema | Factorial | Scor | 60 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.27 kb |
#include <fstream.h>
int main()
{int j,n=0,x=0;
long p;
ifstream f("fact.in");
f>>p;
f.close();
while(x<p)
{n=n+5;
j=n;
do {j=j/5; x++;}
while(j%5==0);}
if(p==0) n++;
ofstream g("fact.out");
if(x==p) g<<n;
else g<<-1;
g.close();
return 0;
}