Cod sursa(job #928380)
| Utilizator | Data | 26 martie 2013 13:50:12 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <stdio.h>
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
long long int p, n, i, j, c;
scanf("%lld",&p);
if (!p) printf("1\n");
else for ( i = 4*p; i <= n; i++ )
{
j = 0;
if ( i / 5 > p ){ printf("-1\n"); break; }
c = i;
while(c > 5)
{
j += c / 5;
c = c / 5;
}
if ( j == p ) { printf("%lld\n",i); break; }
}
return 0;
}
