Cod sursa(job #1175169)

Utilizator tudor32Lascu Tudor Andrei tudor32 Data 24 aprilie 2014 17:13:35
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p;

int nrzero(int x)
{
    int i,k=0,y;
    for (i=1;i<=x;i++)
    {
        y=i;
        while (y%5==0)
        {
            k++;
            y/=5;
        }
    }
    return k;
}

void rezolva()
{
    int i=1,x;
    do
    {
        x=nrzero(i);
        i++;
    }while (x!=p);
    g<<i-1<<'\n';
}

int main()
{
    f>>p;
    if (p==0)
    {
        g<<1<<'\n';
        return 0;
    }
    else
    rezolva();
    return 0;
}