Cod sursa(job #883771)

Utilizator StefansebiStefan Sebastian Stefansebi Data 20 februarie 2013 12:52:36
Problema Factorial Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int i, p, cont5, y;
int main() {
    fin >> p;
    cont5 = 0; i = 0;
    while (cont5 < p) {
        i = i + 5;
        y = i;
        while (y % 5 == 0) {
            y = y / 5;
            cont5++;
        }
    }
    if (p == 1)
        fout << 0;
    else
        fout << i;
}