Pagini recente » Cod sursa (job #2961636) | Cod sursa (job #1111623) | Cod sursa (job #561316) | Cod sursa (job #1721762) | Cod sursa (job #3189681)
#include <bits/stdc++.h>
using namespace std;
const int nmax = 400, base = 1e9;
int a[5 + nmax];
void mult(int x, int &nc) {
long long t = 0;
for (int i = 0; i < nc; ++i) {
a[i] = (t += 1ll * x * a[i]) % base;
t /= base;
}
while (t) {
a[nc++] = t % base;
t /= base;
}
}
int main() {
ifstream fin("patrate2.in");
ofstream fout("patrate2.out");
int n;
fin >> n;
int nc = 1;
a[0] = 1;
for (int i = 1; i <= n * n; ++i) {
mult(2, nc);
if (i <= n) {
mult(i, nc);
}
}
fout << a[nc - 1];
for (int i = nc - 2; i >= 0; --i) {
for (int j = 10; j < base; j *= 10) {
if (a[i] < j) {
fout << "0";
}
}
fout << a[i];
}
fout << '\n';
return 0;
}