Cod sursa(job #2624522)

Utilizator Cibotaru.MateiMatei-Stefan Cibotaru Cibotaru.Matei Data 4 iunie 2020 22:33:03
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.36 kb
#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	fstream f("input.txt", ios::in);
	
	long p;
	f >> p;
	long z = p;

	f.close();

	f.open("output.txt", ios::out);

	if (p == 0) f << 1;
	else {
		int aux = 5;
		while (p / aux > 0) {
			z -= p / aux;
			aux *= 5;
		}
		f << z * 5;
	}
	
	f.close();
}