Cod sursa(job #2075204)

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

using namespace std;

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

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

    out << n-5;
    return 0;
}