Cod sursa(job #1107069)

Utilizator terrorturtle01Ion George Mihai terrorturtle01 Data 13 februarie 2014 17:00:55
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <fstream>
using namespace std;
int P, nrz;
long N, MAX = 9999999;

int zero(int k){
    long m = 5;
    int z = 0;
    while(k/m != 0){
        z+=k/m;
        m*=5;
    }
    return z;
}

/*int searchN(){

    return N;
}
*/
int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>P;
    if(P==0){
        g<<1;
    }else{
        while(nrz != P){
            nrz = zero(N);
            N++;
        }
        g<<N-1;
    }
    return 0;
}