Pagini recente » Cod sursa (job #2911442) | Cod sursa (job #2063267) | Cod sursa (job #3032820) | Autentificare | Cod sursa (job #2325997)
#ifdef INFOARENA
#include <fstream>
std::ifstream is{"fact.in"};
std::ofstream os{"fact.out"};
#else
#include <iostream>
#define is std::cin
#define os std::cout
#endif // INFOARENA
#define not_(expr) (!(expr))
int main() {
int p;
is >> p;
if (!p) {
os << 1;
return 0;
}
int acc = 1, two = p, five = p;
for (; five > 0 || two > 0; ++acc) {
auto i = acc;
while not_ (i & 1)
--two,
i >>= 1;
while not_ (i % 5)
--five,
i /= 5;
}
os << acc - 1;
}