Cod sursa(job #829181)

Utilizator d0rina2011Craciun Dorina d0rina2011 Data 4 decembrie 2012 21:59:44
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<fstream> 
using namespace std; 
ifstream fin("fact.in");
ofstream fout("fact.out"); 
int main () 
{
    int x,p,k=0,n;
    fin >> p;
    n=p*5;
    if(p==0)fout<<"1";
	x=5;
    while(k<p&&x<=n)
	{
		n=x;
		while(n%5==0)
		{
			n=n/5;
	        k++;
		}
		if(k==p)fout<<x;
		else x+=5;
    }
    fin.close();
    fout.close();
    return 0;
}