Cod sursa(job #591441)
| Utilizator | Data | 24 mai 2011 10:39:47 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <fstream.h>
ifstream in("fact.in");
ofstream out("fact.out");
long long n,e,i,aux;
int main()
{
in >> n;
if (n==0)
out << 1;
else if (n==1)
out << 5;
else
{
e = 0;
for (i=5;e<n;i+=5)
{
aux = i;
while (aux%5==0)
{ e++; aux/=5; }
}
if (e==n)
out << i-5;
else
out << -1;
}
}