Cod sursa(job #828877)

Utilizator RaresGabrielMircea Rares-Gabriel RaresGabriel Data 4 decembrie 2012 16:31:20
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<iostream>
#include<cmath>
#include<fstream>

using namespace std;

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

int main () {
     int p,k=0,n=0,y=0;
     fin>>p;
     if(p==0)fout<<"-1";
     while(n!=p){y=y+5;
                         k=y;
                        while(k%5==0){k=k/5;
                                                  n++;}
     }
    fout<<y;

    fin.close();
    fout.close();

    return 0;
}