Cod sursa(job #3148467)
Utilizator | Data | 1 septembrie 2023 16:50:20 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p;
int main()
{
fin >> p;
int i = 2, ct2 = 0, ct5 = 0;
while (ct2 < p || ct5 < p)
{
int aux = i;
while (aux % 2 == 0)
{
ct2++;
aux /= 2;
}
while (aux % 5 == 0)
{
ct5++;
aux /= 5;
}
i++;
}
fout << i - 1;
return 0;
}