Cod sursa(job #359295)
Utilizator | Data | 26 octombrie 2009 15:47:52 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
long int p = 0;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin >> p;
long int max = p * 5;
long int nr = 0;
for (int i = 2; pow(5.0, (double)i) < max; i++)
nr += (i-1);
p -= nr;
fout << p * 5;
fout.close();
fin.close();
return 0;
}