Cod sursa(job #1235050)

Utilizator CodrinsahCotarlan Codrin Codrinsah Data 28 septembrie 2014 17:14:57
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <fstream>
using namespace std;
ifstream fi ("factorial.in");
ofstream fo ("factorial.out");
unsigned long long p,x,n,a,b;
int main()
{
    fi>>p;
    while (x==0)
    {
        n++;
        x=n;
        if (a<p)
            while (x%2==0)
        {
            x=x/2;
            a++;
            if (a>=p) break;
        }
        if (b<p)
            while (x%5==0)
        {
            x=x/5;
            b++;
            if (b>=p) break;
        }
        x=0;
        if ((a>=p) and (b>=p)) break;
    }
    fo<<n;
    return 0;
}