Pagini recente » Cod sursa (job #2733255) | Cod sursa (job #1274035) | Cod sursa (job #1079128) | Cod sursa (job #1328210) | Cod sursa (job #2202771)
///infoarena problema factorial
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int nrz;
int main()
{
int contor = 0;
long long nrcrt = 5;
long long temp = 0;
fin >> nrz;
if (0 == nrz)
fout << 1;
while (contor < nrz)
{
temp = nrcrt;
while (temp % 10 == 0) {
contor++;
temp /= 10;
}
while (temp % 5 == 0) {
contor++;
temp /= 5;
}
if (contor == nrz)
{
fout << nrcrt;
return 0;
}
else
nrcrt += 5;
}
fout << "-1";
return 0;
}