Cod sursa(job #1950810)

Utilizator ionutpop118Pop Ioan Cristian ionutpop118 Data 3 aprilie 2017 11:58:55
Problema Patrate2 Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.21 kb
#include <cstdio>
#include <cstring>
using namespace std;
class HugeN
{
    private:
        int x[10005];
    public:
        HugeN(int n)
        {
            memset(x, 0, sizeof(x));
            do
            {
                x[ ++x[0]] = n % 10;
                n = n / 10;
            }while (n);
        }
        void print()
        {
            for (int i = x[0]; i >= 1; --i)
                printf("%d", x[i]);
            printf("\n");
        }

        HugeN operator *(int k) /// HUGE * INT
        {
            int t = 0; HugeN c(0);
            c.x[0] = x[0];
            for (register int i = 1; i <= x[0]; ++i)
            {
                t = x[i] * k + t;
                c.x[i] = t % 10;
                t /= 10;
            }
            while (t > 0)
            {
                c.x[++c.x[0]] = t % 10;
                t /= 10;
            }
            return c;
        }
};

int main()
{
    freopen("patrate2.in", "r", stdin);
    freopen("patrate2.out", "w", stdout);
    HugeN a(1);
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        a = a * i;
    for (int i = 1; i <= n * n; ++i)
        a = a * 2;
    a.print();
    return 0;
}