Cod sursa(job #3238877)
| Utilizator | Data | 31 iulie 2024 11:51:20 | |
|---|---|---|---|
| Problema | Factorial | Scor | 80 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int 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;
}
