Cod sursa(job #702499)

Utilizator harababurelPuscas Sergiu harababurel Data 1 martie 2012 22:14:13
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <fstream>
#include <limits.h>
using namespace std;
int p,z;

int zerouri(int n) {
	int rez=0, k=n;
	while(k%5==0) { k/=5; rez++; }
	
	if(n==1) { return 0; }
	return (rez+zerouri(n-1));
}
int main() {
	ifstream f("fact.in");
	ofstream g("fact.out");
	f>>p;
	cout<<p<<"\n";
	
	int start, stop, mij, i;
	start=1; stop=INT_MAX-1;
	
	i=1;
	while(zerouri(i)<p) { i++; }
	
	g<<i;
	
	
	f.close();
	g.close();
	return 0;
}