Cod sursa(job #788537)

Utilizator dogDaysAreOverAndreea Gheorghe dogDaysAreOver Data 15 septembrie 2012 12:03:02
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>
#include <math.h>

#define inputFile "fact.in"
#define outputFile "fact.out"
#define MAX 16000

using namespace std;

int p, n;

int main(){
	ifstream in(inputFile);
	in>>p ;

	int countDigits = 0;
	n = 0;
	int count = 0;

	while(countDigits < p){
		count ++;
		countDigits++ ;
		if(count %5 ==0)
			countDigits ++;
	}

	if(count %2 == 1 )
		n = 5;

	n = 10*(count /2 ) + n;

	ofstream output;
	output.open(outputFile);

	output << n << endl;
	output.close();
}