Pagini recente » Cod sursa (job #671841) | Cod sursa (job #1373833) | Cod sursa (job #110442) | Cod sursa (job #1280373) | Cod sursa (job #359309)
Cod sursa(job #359309)
#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 (long int i = 25; i < max; i += 5)
if (i % 25 == 0)
{
int j = i /5;
while ( j % 5 == 0)
{
nr++;
j /= 5;
}
}
p -= nr;
fout << p * 5;
fout.close();
fin.close();
return 0;
}