Pagini recente » Cod sursa (job #2068899) | Cod sursa (job #2346258)
#include <cstdio>
#include <iostream>
using namespace std;
int nr_zero( int a, int x ){
if( x > a )
return 0;
return a / x + nr_zero( a, x * 5 );
}
int cb( int p ){
int st = 0, dr =1000000000;
while( dr - st > 1 ){
int med = ( dr + st ) >> 1;
if( nr_zero(med, 5) < p )
st = med;
else
dr = med;
}
return dr;
}
int main()
{
freopen( "fact.in", "r", stdin );
freopen( "fact.out", "w", stdout );
int n;
scanf( "%d", &n );
printf( "%d", cb(n) );
}