Cod sursa(job #874381)
| Utilizator | Data | 8 februarie 2013 11:40:36 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <stdio.h>
using namespace std;
long long p, n, i, x, ap;
int main()
{
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%lld", &p);
n = p;
while(p%5==0)
p/=10;
if(p==0)
{
printf("-1");
} else {
while(p%5==0)
{
p/=5;
ap++;
}
n -= ap;
printf("%d", n * 5);
}
return 0;
}