Pagini recente » Cod sursa (job #151770) | Cod sursa (job #1218036) | Cod sursa (job #1256254) | Cod sursa (job #718766) | Cod sursa (job #2959879)
#include <bits/stdc++.h>
using namespace std;
/// INPUT / OUTPUT
ifstream fin("fact.in");
ofstream fout("fact.out");
/// GLOBAL VARIABLES
int n, ans;
int countzero(int &num)
{
int div = 5;
int cnt = 0;
while(num / div > 0)
{
cnt += num / div;
div*=5;
}
return cnt;
}
/// SOLUTION
inline void solve()
{
if(n == 0)
{
fout << 1;
return;
}
int st = 1, dr = 1e9;
while(st <= dr)
{
int mid = (st + dr) / 2;
int c = mid;
int zero = countzero(mid);
if(zero == n)
{
ans = c;
dr--;
}
if(zero > n)
{
dr = mid - 1;
}
if(zero < n)
{
st = mid + 1;
}
}
fout << ans;
}
/// READING THE INPUT
int main()
{
ios::sync_with_stdio(false);
fin.tie(NULL);
fout.tie(NULL);
fin >> n;
solve();
}