Cod sursa(job #600885)

Utilizator luckyme91wiz kid luckyme91 Data 4 iulie 2011 00:00:02
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <iostream>
#include <fstream>

using namespace std;

int main () {

ifstream in ("fact.in");
ofstream out ("fact.out");

int n, i, count, temp, p;

in >> n;
count = 0;
p = 1;
for (i = 1; i; i+=p)
{
	temp = i;
	while (temp % 5 == 0)
	{
		temp /= 5;
		count ++;
	}
	if (i == 5)
	p = 5;
	if (count == n)
	{
		out << i;
		break;
	}
}
return 0;
}