Pagini recente » Cod sursa (job #2894130) | Cod sursa (job #154019) | Cod sursa (job #3284053) | Cod sursa (job #1217253) | Cod sursa (job #3191012)
#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
ifstream fin("patrate2.in");
ofstream fout("patrate2.out");
const int BAZA = 10000;
typedef int nrmare[2000];
// formula este 2^{N*N}*N!;
// implementare pe nmr mari si baza 10 000;
void inmultire(nrmare x,int n){
int t = 0;
for(int i = 1; i <=x[0]; i++,t/=BAZA){
t = t+n*x[i];
x[i] = t%BAZA;
};
for( ;t;t/=BAZA){
x[++x[0]] = t%BAZA;
}
}
int main()
{
int n;fin >> n;
nrmare y;
y[0] = 1;
y[1] = 1;
for(int i = 1; i <=n*n; i++){
inmultire(y,2);
};
for(int i = 2; i <=n; i++){
inmultire(y,i);
};
fout << y[y[0]];
for(int i = y[0]-1; i >= 1; i--){
fout << setfill('0') << setw(4) << y[i];
};
return 0;
}