Cod sursa(job #2075211)

Utilizator AndreiVisoiuAndrei Visoiu AndreiVisoiu Data 25 noiembrie 2017 11:56:30
Problema Factorial Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>

using namespace std;

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

int p, x, z, n = 5, n2;
bool ok = true;
int main()
{
    in >> p;
    if(p == 0) { out << 1; return 0; }
    while(z < p) {
        n2 = n;
        while(n2%5 == 0) {
            n2 = n2/5;
            z++;
        }
        n += 5;
    }

    out << n-5;
    return 0;
}