Cod sursa(job #3238878)
Utilizator | Data | 31 iulie 2024 11:52:38 | |
---|---|---|---|
Problema | Factorial | Scor | 75 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
long long p, i = 0, cop, nr_zero = 0;
fin >> p;
if ( p == 0 )
{
fout << 1 << '\n';
return 0;
}
while ( nr_zero < p )
{
i += 5;
cop = i;
while ( cop % 5 == 0 )
++nr_zero, cop /= 5;
}
fout << i << '\n';
return 0;
}