Pagini recente » Cod sursa (job #2057511) | Cod sursa (job #506928) | Cod sursa (job #2855328) | Cod sursa (job #692860) | Cod sursa (job #2913763)
#include <bits/stdc++.h>
using namespace std;
ifstream fin( "patrate2.in" );
ofstream fout( "patrate2.out" );
const int MAXD = 10005;
struct large {
int nd, d[MAXD];
large operator * ( const int &a ) {
large res;
res.init();
int tr = 0, n = this -> nd;
int i;
for ( i = 1; i <= n || tr > 0; ++i ) {
tr += a * (this -> d[i]);
res.d[i] = tr % 10;
tr /= 10;
}
if ( i > n ) {
res.nd = --i;
} else {
res.nd = n;
}
return res;
}
void print() {
for ( int i = (this -> nd); i >= 1; --i ) {
fout << this -> d[i];
}
fout << "\n";
}
void init() {
for ( int i = 0; i < MAXD; ++i ) this -> d[i] = 0;
this -> nd = 0;
}
};
large transform( int n ) {
large res;
int idx = 0;
res.init();
while ( n ) {
res.d[++idx] = n % 10;
n /= 10;
++res.nd;
}
return res;
}
int main() {
int n;
fin >> n;
// 2^n * n! * 2^(n^2-n) == 2^n^2 * n!
large res = transform(1);
for ( int i = 1; i <= n*n; ++i ) {
res = res * 2;
}
for ( int i = 1; i <= n; ++i ) {
res = res * i;
}
res.print();
fin.close();
fout.close();
return 0;
}