Cod sursa(job #2460659)
| Utilizator | Data | 24 septembrie 2019 09:08:39 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
#include <cmath>
int main()
{
std::ifstream in("fact.in");
std::ofstream out("fact.out");
int numar, nrDeCifreFact;
in >> numar;
if (numar < 0) nrDeCifreFact = -1;
if (numar <= 1) nrDeCifreFact = 1;
double x = ((n * std::log10(n / M_E) +
std::log10(2 * M_PI * n) / 2.0));
nrDeCifreFact = std::floor(x) + 1;
out << nrDeCifreFact << '\n';
return 0;
}
