Cod sursa(job #727154)
| Utilizator | Data | 27 martie 2012 19:33:39 | |
|---|---|---|---|
| Problema | Factorial | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <cstdio>
using namespace std;
FILE *f1, *f2;
long long i = 5,x;
long int nrz = 0,p;
int main()
{
f1 = freopen("fact.in", "r", stdin);
scanf("%li", &p);
while(nrz<p)
{
x=i;
while(x%5 == 0)
{
nrz++;
x/=5;
}
i+=5;
}
i-=5;
f2 = freopen("fact.out", "w", stdout);
if(nrz == p) printf("%lli\n", i);
else printf("-1\n");
fclose(f2);
fclose(f1);
return 0;
}