Cod sursa(job #545966)

Utilizator alia_deiCristina Sirbu alia_dei Data 4 martie 2011 10:25:52
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<iostream.h>
#include<fstream.h>

int main()
{
	ifstream f;
	f.open("fact.in");
	ofstream g;
	g.open("fact.out");
	int p, l=0, i=1;
	f>>p;
	int ok=0;
	while(!ok)
	{
		int aux=i;
		if (aux%5==0) 
			while(aux%5==0)
		  {
			  l++;
			  aux/=5;
		  }
		if (l>=p) ok=1;
		else i++;
	}
	if(l==p) g<<i;
	else g<<-1;
	f.close();
	g.close();
	
			
	return 0;
}