Cod sursa(job #2225370)

Utilizator eduardandrei20Nechifor Eduard Andrei eduardandrei20 Data 26 iulie 2018 20:17:11
Problema Patrate2 Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.49 kb
#include <bits/stdc++.h>

using namespace std;

//Formula 2 ^ ( n^2 ) * n !
// Pe nr mari
ofstream out("patrate2.out");
ifstream in("patrate2.in");
class nrmare
{ private:
   int     v[100000];
public :
  int& operator[] ( const int &x) {
        return v[x];
    }
    void operator =(int n)
           {
               v[0]=0;
               while(n)
               {
                   v[++v[0]]=n%10 , n /=10;
               }
           }
void operator=(nrmare b) {
        memset(v,0,sizeof(v));
        int i;
        for (i = 0; i <= b[0]; i++)
            v[i] = b[i];
    }

   void operator += (nrmare b)
      {
          int i , t=0;
          nrmare c;

           for( i=1; i<=v[0] or i<=b[0] or t ; i++, t/=10)
           {
               c[i]= (t+=v[i]+b[i])%10;
           }
    c[0]=i-1;
  *this=c;
      }

           void operator *=(int n)
           {
              // nrmare b;
               int i , t=0;
                for( i =1; i <=v[0] or t ; i++ , t/=10)
                {
                    v[i]= (t+=v[i]*n)%10;
                }
                v[0]=i-1;
           }

};

ostream& operator<<(ostream& out, nrmare a) {
    int i;
    for (i = a[0]; i >= 1; i--)
        out << a[i];
    return out;
}



int main()
{ nrmare k;
    int n ;
    in >> n ;
    k=1;
    for( int i=1;i<=n;++i )
        for(int j=1;j<=n;++j)
            k*=2;
    for(int i =1; i<=n;++i)
        k*=i;
      out<<k;


    return 0;
}