Pagini recente » Statistici Voineag Vladimir (voineag.vladimir) | Cod sursa (job #430743) | Rating Robert Florea (RobertFlorea) | Rating negrescu ciprian (negrescuciprian) | Cod sursa (job #1694477)
#include <cstdio>
using namespace std;
int Zero( int n )
{
int p5 = 5, s = 0;
while( p5 <= n )
s += n / p5, p5 *= 5;
return s;
}
int Caut_Bin( int p )
{
int n = 0, pas = 1 << 29;
while( pas > 0 )
{
if( Zero(n + pas) < p )
n += pas;
pas /= 2;
}
return n + 1;
}
int main()
{
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
int p;
scanf("%d", &p);
printf("%d", Caut_Bin(p));
return 0;
}