Pagini recente » Cod sursa (job #2555714) | Cod sursa (job #844155) | Cod sursa (job #2396355) | Cod sursa (job #1793853) | Cod sursa (job #2061878)
#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;
int P;
int nrZero(int);
int main() {
in>>P;
if (P == 0) {
out<<1;
return 0;
}
const int lim = 4e8 + 5;
int 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;
}
int nrZero(int x) {
int ans = 0, pw = 5;
while (x / pw != 0) {
ans += x / pw;
pw *= 5;
}
return ans;
}