Cod sursa(job #1427845)

Utilizator GeiGeiGeorge Cioroiu GeiGei Data 3 mai 2015 09:08:03
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <fstream>

using namespace std;

int main() {
    ifstream fi("fact.in");
    ofstream fo("fact.out");

    long p;
    fi >> p;
    long ans = 5;

    while (p > 0) {
        long aux = ans;
        while (aux % 5 == 0) {
            aux /= 5;
            p--;
        }
        ans += 5;
    }

    fo << ans;

    return 0;
}