Pagini recente » Cod sursa (job #1358318) | Diferente pentru blog/metaprogramare-cu-template-uri intre reviziile 4 si 5 | Cod sursa (job #2509558) | Cod sursa (job #2658279) | Cod sursa (job #2233610)
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int v[100000002];
int p;
int main()
{
fin >> p;
v[0] = 1;
int poz = 1;
long long nr = 5;
while(poz <= p)
{
int exp;
exp = 25;
while(nr % exp == 0)
{
v[poz] = -1;
poz ++;
exp *= 5;
}
v[poz] = nr;
nr += 5;
poz ++;
}
fout << v[p];
return 0;
}