Pagini recente » Cod sursa (job #2976869) | Cod sursa (job #118107) | Cod sursa (job #1413134) | Cod sursa (job #1863081) | Cod sursa (job #2609800)
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
// #include <chrono>
using namespace std;
using namespace std::chrono;
ifstream f("fact.in");
ofstream g("fact.out");
long int p, v[2];
long long int nr;
long long int aux = nr;
long long int k = 0;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
v[0] = 0;
v[1] = 0;
// auto start = high_resolution_clock::now();
f >> p;
for (nr = 2; v[0] < p || v[1] < p; nr++)
{
k = 0;
aux = nr;
while (aux % 5 == 0)
{
aux /= 5;
k++;
}
v[0] += k;
k = 0;
aux = nr;
while (aux % 2 == 0)
{
aux /= 2;
k++;
}
v[1] += k;
}
if (v[0] > p && v[1] > p)
g << -1;
else
g << nr - 1;
// auto stop = high_resolution_clock::now();
// auto duration = duration_cast<microseconds>(stop - start);
// cout << '\n' << "Time taken by function: " << duration.count() << " microseconds" << '\n';
return 0;
}