Cod sursa(job #837742)

Utilizator VladThVintilescu Vlad VladTh Data 18 decembrie 2012 16:52:06
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<fstream>
using namespace std;

int zeros(int n)
{
	int sum=n/5,d=25;
	while(n/d!=0)
	{
		sum+=(n/d);
		d*=5;
	}
	return sum;
}

int main()
{
	ifstream fin("fact.in");
	ofstream fout("fact.out");
	int p;
	fin>>p;
	int i=1;
	while(zeros(i)!=p)
	{
		i++;
	}
	fout<<i;
	fin.close();
	fout.close();
	return 0;
}