Pagini recente » Cod sursa (job #1792974) | Cod sursa (job #649748) | Cod sursa (job #2052694) | Cod sursa (job #908063) | Cod sursa (job #2455113)
#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
#define rc(x) return cout<<x<<endl,0
#define forn(i,n) for(int i=0;i<int(n);i++)
#define len(a) (int) (a).size()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const int nmax=1e5+3;
const int mod=998244353;
const ll inf=0x3f3f3f3f3f3f3f3f;
/*===================*\
comentarii:
\*===================*/
using namespace std;
int zerouri(int p)
{
int aux=0;
while(p>=5)
{
aux+=p/5;
p/=5;
}
return aux;
}
int cb(int st, int dr,int n)
{
int mid,sol=-1;
while(st<=dr)
{
mid=(st+dr)/2;
int nr=zerouri(mid);
if(nr==n) sol=mid;
if(nr<n) st=mid+1; else dr=mid-1;
}
return sol;
}
int main()
{
//freopen("bfs.in","r",stdin);
//freopen("bfs.out","w",stdout);
ifstream fin("fact.in");
ofstream fout("fact.out");
int n;
fin>>n;
int st=1,dr=500000000;
fout<<cb(st,dr,n);
}