Pagini recente » Cod sursa (job #43116) | Cod sursa (job #168917) | Cod sursa (job #1473426) | Cod sursa (job #268350) | Cod sursa (job #518511)
Cod sursa(job #518511)
#include <cstdio>
using namespace std;
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
int p,x,y=5,t=0;
bool nicht=false;
scanf ("%d",&p);
x=5*p;
while (y<p)
{
y+=6;
t++;
if (p==y)
nicht=true;
}
y=5;
while (y<x)
{
y*=5;
t++;
}
t-=2;
t*=5;
x-=t;
if (nicht==false)
printf ("%d \n",x);
else
printf ("-1 \n");
}