Pagini recente » Cod sursa (job #2529591) | Cod sursa (job #2239461) | Cod sursa (job #516260) | Cod sursa (job #2538198) | Cod sursa (job #2699411)
//ALEXANDRU MICLEA
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <time.h>
#include <iomanip>
#include <deque>
#include <math.h>
#include <cmath>
#include <assert.h>
#include <stack>
#include <bitset>
#include <random>
#include <chrono>
#include <assert.h>
#include <iostream>
using namespace std;
using ll = long long;
#define fast_cin() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
//VARIABLES
vector <int> m5;
const int maxn = 100000005;
int v[maxn];
//FUNCTIONS
int zero(int val) {
// given val, return number of trailing zeroes for val!
int tot = 0;
int m5 = 5;
while (val / m5) {
tot += (val / m5);
m5 *= 5;
}
return tot;
}
//MAIN
int main() {
#ifdef INFOARENA
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
#endif
fast_cin();
int p; cin >> p;
if (p == 0) {
cout << '1';
return 0;
}
int ans = -1;
int st = 1, dr = maxn;
while (st <= dr) {
int mid = (st + dr) / 2;
if (zero(mid) == p && (mid % 5) == 0) ans = mid;
if (zero(mid) < p) st = mid + 1;
else dr = mid - 1;
}
cout << ans << '\n';
return 0;
}