Pagini recente » Cod sursa (job #997594) | Cod sursa (job #1571425) | Cod sursa (job #1317373) | Cod sursa (job #2769881) | Cod sursa (job #2772316)
#include <iostream>
#include <chrono>
#include <fstream>
using namespace std::chrono;
std::ifstream f1("fact.in");
std::ofstream f2("fact.out");
int pof(int t) {
if (t % 5 == 0) {
return 1 + pof(t / 5);
}
return 1;
}
void factorial() {
int target;
// std::ifstream f1(stdin);
// std::ofstream f2(stdout);
// f2 << "input: ";
f1 >> target;
int counter = 0;
while (target > 0) {
counter += 5;
target -= pof(counter / 5);
}
f2 << counter << std::endl;
while (true);
}
int main() {
auto start = high_resolution_clock::now();
factorial();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<milliseconds>(stop - start);
std::cout << std::endl << "[time]:" << duration.count() << std::endl;
return 0;
}