Pagini recente » Cod sursa (job #866377) | Cod sursa (job #1552916) | Cod sursa (job #1309837) | Cod sursa (job #1226123) | Cod sursa (job #582846)
Cod sursa(job #582846)
#include <cstdio>
using namespace std;
int p;
int main()
{
int i,n,ok;
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&p);
if(p==0)
{
printf("1");
return 0;
}
fclose(stdin);
for(i=p;;i++)
{
n=i;ok=0;
while(n/5!=0)
{
n/=5;
ok+=n;
}
if(ok==p)
{
printf("%d\n",i);
return 0;
}
if(ok>p)
break;
}
printf("-1\n");
fclose(stdout);
return 0;
}