Pagini recente » Cod sursa (job #2092778) | Cod sursa (job #1299899) | Cod sursa (job #2088103) | Cod sursa (job #1289469) | Cod sursa (job #2093411)
#include <cstdio>
int P, N, step;
int zeroes(int N)
{
for(int i = 5, z = 0;; i *= 5)
{
z += N / i;
if(i > N) return z;
}
};
int main(){
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%d", &P);
for(step = 1; step < 400000015; step <<= 1);
for(N = 400000015; step; step >>= 1)
if(zeroes(N - step) >= P) N -= step;
printf("%d", zeroes(N) != P ? -1 : P ? N : 1);
return 0;
}