Pagini recente » Cod sursa (job #376634) | Cod sursa (job #2901387) | Cod sursa (job #2365975) | jc2018-runda-2 | Cod sursa (job #2611385)
#include <cstdlib>
#include <fstream>
#include <iostream>
auto main() noexcept -> int
{
std::ifstream f{ "fact.in" };
std::ofstream g{ "fact.out" };
int num{ 0 };
int count{ 0 };
f >> num;
if(num == 0) {
g << '1' << std::endl;
return EXIT_SUCCESS;
}
for(int i = 5;; i += 5) {
int j = i;
while(j % 10 == 0) {
++count;
j /= 10;
}
while(j % 5 == 0) {
++count;
j /= 5;
}
if(count > num) {
g << "-1" << std::endl;
return EXIT_SUCCESS;
}
if(count == num) {
g << i << std::endl;
return EXIT_SUCCESS;
}
}
}