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