Cod sursa(job #526433)
Utilizator | Data | 28 ianuarie 2011 12:37:07 | |
---|---|---|---|
Problema | Factorial | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<stdio.h>
int n,p,i;
int nr0(int x)
{
int nr=0;
while(x)
{
nr+=x/5;
x/=5;
}
return nr;
}
int caut(int x)
{
int i,pas=1<<30;
for(i=0;pas!=0;pas>>=1)
if(nr0(i+pas)<p)
i+=pas;
return i+1;
}
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&p);
printf("%d",caut(i));
return 0;
}