Pagini recente » Monitorul de evaluare | Cod sursa (job #2327995) | Diferente pentru problema/boring intre reviziile 8 si 7 | Cod sursa (job #1463366) | Cod sursa (job #2516401)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p, k=1;
double n;
int main()
{
fin>>p;
if(!p)
fout<<1;
else if(p<=5)
fout<<5*p;
else
{
while(k*5<=p)
k*=5;
n=(double)(p*4*k)/(k-1);
n=(int)(n+5)/5*5;
if(k*5<n)
{
k*=5;
n=(double)(p*4*k)/(k-1);
if(n!=(int)n)
n=(int)(n+5)/5*5;
}
fout<<n;
}
return 0;
}