Cod sursa(job #2392892)

Utilizator noperestayadelin mihoc noperestay Data 30 martie 2019 16:10:51
Problema Factorial Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <cstring>
#include <algorithm>
#include <fstream>

using namespace std;

ifstream f("fact.in");
ofstream g("fact.out");

int p, fact[2], i, exponent;

void rezolvare() {
	i = 5;
	while (p > 0) {
		if (!(i % 5)) {
			int auxi = i;
			int numar5 = 0;
			while (!(auxi % 5)) {
				auxi /= 5;
				numar5++;
			}
			p -= numar5;
		}
		i++;
	}
	g << i - 1;
}

int main() {

	f >> p;
	rezolvare();

	return 0;
}