Cod sursa(job #2284746)
Utilizator | Data | 17 noiembrie 2018 14:49:52 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
int p;
long long i=5, c;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
if (!p)
fout<<1;
else
{
while (p)
{
c=i;
while (c%5==0)
{
p--;
c/=5;
}
i+=5;
}
fout<<i-5;
}
return 0;
}