Cod sursa(job #2326346)

Utilizator Raul09062000Ianos Raul-Daniel Raul09062000 Data 23 ianuarie 2019 14:04:16
Problema Factorial Scor 25
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("fact.in");
ofstream g("fact.out");

int nr5(int x)
{
    int cnt=0;
    while(x%5==0)
    {
        cnt++;
        x/=5;
    }
    return cnt;
}

int main()
{int p;
    long long int nr=0;
    f>>p;
    if(p==0)
    {
        g<<1;
        return 0;
    }
    while(p>0)
    {      nr+=5;
        p-=nr5(nr);

    }
    g<<nr;
    return 0;
}