Pagini recente » Cod sursa (job #78964) | Cod sursa (job #1746611) | Cod sursa (job #953051) | Cod sursa (job #1863066) | Cod sursa (job #1453006)
#include <cstdio>
#include <iostream>
#include <iomanip>
#define base 10000
using namespace std;
class BigInt {
public:
int digit[100];
int n_digit;
BigInt(int n = 0) {
n_digit = 0;
while (n > 0) {
digit[n_digit] = n % base;
n /= base;
n_digit++;
}
if (n_digit == 0) {
n_digit = 1;
digit[0] = 0;
}
}
BigInt(const BigInt& a) {
n_digit = a.n_digit;
for (int i = 0; i < n_digit; i++) {
digit[i] = a.digit[i];
}
}
BigInt operator = (BigInt a) {
n_digit = a.n_digit;
for (int i = 0; i < n_digit; i++) {
digit[i] = a.digit[i];
}
return *this;
}
friend BigInt operator + (BigInt a, BigInt b) {
BigInt ans;
if (a.n_digit > b.n_digit) {
BigInt aux = b;
b = a;
a = aux;
}
long carry = 0;
for (int i = 0; i < a.n_digit; i++) {
carry += a.digit[i] + b.digit[i];
ans.digit[i] = carry % base;
carry /= base;
}
for (int i = a.n_digit; i < b.n_digit; i++) {
carry += b.digit[i];
ans.digit[i] = carry % base;
carry /= base;
}
ans.n_digit = b.n_digit;
while (carry > 0) {
ans.digit[ans.n_digit] = carry % base;
carry /= base;
ans.n_digit++;
}
return ans;
}
friend BigInt operator * (BigInt a, int b) {
long long carry = 0;
BigInt ans;
for (int i = 0; i < a.n_digit; i++) {
carry += a.digit[i] * b;
ans.digit[i] = carry % base;
carry /= base;
}
ans.n_digit = a.n_digit;
while (carry > 0) {
ans.digit[ans.n_digit] = carry % base;
carry /= base;
ans.n_digit++;
}
return ans;
}
friend ostream& operator << (ostream& o, BigInt a) {
o << a.digit[a.n_digit - 1];
o << setfill('0') << setw(4);
for (int i = a.n_digit - 2; i >= 0; i--) {
o << a.digit[i];
}
}
};
int main() {
freopen("patrate2.in", "r", stdin);
freopen("patrate2.out", "w", stdout);
int n;
cin >> n;
BigInt ans(1);
for (int i = 1; i <= n; i++) {
ans = ans * i;
}
for (int i = 0; i < n * n; i++) {
ans = ans * 2;
}
cout << ans;
return 0;
}