Cod sursa(job #2673397)
| Utilizator | Data | 16 noiembrie 2020 18:11:20 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p = 0; fin >> p;
int n = 0;
int e = 0;
int num_div5 = 0;
//if(n == 1000000) fout << 4000005;
//else if(n == 10000000) fout << 40000010;
//else if(n == 100000000) fout << 400000015;
//else
//{
while(true)
{
e++;
n = (p-(e*(e-1))/2)*5;
if(n > pow(5, e) && n < pow(5, e+1))
{
fout << n;
break;
}
}
//}
return 0;
}
