Pagini recente » Cod sursa (job #2884915) | Cod sursa (job #1247306) | Cod sursa (job #1799530) | Cod sursa (job #2448581) | Cod sursa (job #3148467)
#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;
}