Cod sursa(job #898191)

Utilizator ZoLeeKhaSzasz Zoltan ZoLeeKha Data 28 februarie 2013 08:46:07
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>

using namespace std;
ifstream f("factorial.in");
ofstream g("factorial.out");
int n,kapcs=0,i=3,fact=2,j,szl=2;
long long x;

int megoldas()
{
    while(kapcs==0)
    {   szl++;
        fact*=i;
        i++;
        if(fact%x==0)
            return szl;
    }
}

int main()
{
    f>>n;
    x=1;
    for(j=1;j<=n;j++)
        x*=10;
    if(n==0)
        g<<1;
    else
    {
        megoldas();
        g<<szl;
    }
    return 0;
}