Cod sursa(job #428487)

Utilizator rares192Preda Rares Mihai rares192 Data 29 martie 2010 12:11:23
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<fstream>
using namespace std;

ifstream fin("factorial.in");
ofstream fout("factorial.out");

int main()
{
	unsigned long long p, nr=0, i, j, k;
	
	fin>>p;
	
	if(p==0) fout<<1;
	else
	{
		j=p;
		while(j%5==0)
		{
			nr++;
			j=j/5;
		}
		
	    p=p-nr;
	k=p*5;
	fout<<k;
	}
	
return 0;
fin.close();
fout.close();
}