Cod sursa(job #339153)

Utilizator Nickyu0712Nichita Utiu Nickyu0712 Data 8 august 2009 15:18:20
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>

using namespace std;

long P, R;

int main() {
	ifstream fin("fact.in");
	fin >> P;
	fin.close();
	ofstream fout("fact.out");
	if( P == 0 ) {
		fout << 1;
		fout.close();
		return 0;
	}
	long temp,i;
	for(i=5; R<P; i+=5 ) {
		temp=i;
		while( temp > 4 ) {
			R++;
			temp /= 5;
		}
	}
	fout << i-5;
	fout.close();
	return 0;
}