Pagini recente » Cod sursa (job #2049033) | Cod sursa (job #2061888) | Rating Albuica Lucian Ionut (emberlust) | Cod sursa (job #2028780) | Cod sursa (job #2061887)
#include <iostream>
#include <fstream>
#include <set>
#include <algorithm>
#if 1
#define pv(x) cout<<#x<<" = "<<x<<"; ";cout.flush()
#define pn cout<<endl
#else
#define pv(x)
#define pn
#endif
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
#define pb push_back
#define mp make_pair
const int NMax = 5e6 + 5;
const ll inf = 1e18 + 5;
const int mod = 100003;
using zint = int;
ll P;
ll nrZero(ll);
int main() {
in>>P;
if (P == 0) {
out<<1;
return 0;
}
const ll lim = 4e8 + 50;
//cout<<nrZero(lim);
ll nr = 0,pw = 1;
for (;pw <= lim;pw <<= 1) ;
pw >>= 1;
while (pw) {
if (nrZero(nr+pw) < P) {
nr += pw;
}
pw >>= 1;
}
out<<nr+1;
in.close();out.close();
return 0;
}
ll nrZero(ll x) {
ll ans = 0, pw = 5;
while (x / pw != 0) {
ans += x / pw;
pw *= 5;
}
return ans;
}