Cod sursa(job #613592)
Utilizator | Data | 1 octombrie 2011 13:26:21 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
using namespace std;
int main()
{
unsigned long p,n=0,i=5,j;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
f.close ();
if (p==0)
g<<"1";
else
{
while (n<p)
{
j=i;
while (!(j%5))
{
n++;
j=j/5;
}
i=i+5;
}
if (n==p)
g<<i-5;
else
g<<"-1";
}
return 0;
}