Bigint(int x = 0){ memset(a, 0, sizeof(a)); for (len = 1; x; len++){ a[len] = x % 10; x /= 10; } len--; } int &operator[](int i) {return a[i];}
voidflatten(int L){ len = L; for (int i = 1; i <= len; i++){ a[i + 1] += a[i] / 10; a[i] = a[i] % 10; } while(!a[len]) len--; }
Bigint operator*(int b) const{ Bigint c; for (int i = 1; i <= len; i++) c[i] = a[i] * b; c.flatten(len + to_string(b).length()); return c; }
voidprint(){ for (int i = len; i >= 1; i--){ cout << a[i]; } } };
intmain(){ int n; cin >> n;
vector <int> q; int sum = 0; if (n >= 4){ for (int i = 2; i + sum <= n; i++){ q.push_back(i); sum += i; } int p = q.size() - 1; int t = n - sum; while (t){ if (p == -1) p = q.size() - 1; q[p]++; p--; t--; } for (auto tmp : q) cout << tmp << " "; cout << "\n";
Bigint ans(1); for (auto tmp : q){ ans = ans * tmp; } ans.print(); } else cout << n; return0; }
structBigInt{ int len; int a[MAXN]; voidinit(int x){ int index = 1; memset(a, 0, sizeof(a)); while (x){ a[index++] = x % 10; x /= 10; } len = max(index - 1, 1); } int& operator[](int i){ return a[i]; } voidflatten(int l){ len = l; for (int i = 1; i <= len; i++){ a[i + 1] += a[i] / 10; a[i] %= 10; } len++; while (len > 1 && !a[len]) len--; if (len > 500) len = 500; } BigInt operator*(const BigInt &other) const { BigInt res; res.init(0); for (int i = 1; i <= len; i++) for (int j = 1; j <= other.len; j++) res.a[i + j - 1] += a[i] * other.a[j]; res.flatten(len + other.len); return res; } };
BigInt quick_pow(BigInt base, int exp){ BigInt res; res.init(1); while (exp){ if (exp & 1) res = res * base; base = base * base; exp >>= 1; } return res; }
intmain(){ int p; cin >> p; BigInt Bg_2; Bg_2.init(2); BigInt res = quick_pow(Bg_2, p); res.a[1]--;
voidquick_sort(int l, int r){ if (l >= r) return; int pivot = a[(l + r) / 2]; int i = l - 1, j = r + 1; int mid; while (i < j) { do i++; while (a[i] < pivot); do j--; while (a[j] > pivot); if (i < j) swap(a[i], a[j]); } mid = j; quick_sort(l, mid); quick_sort(mid + 1, r); }
voidquick_select(int l, int r){ if (l >= r) return; int pivot = a[(l + r) / 2]; int i = l - 1, j = r + 1; while (i < j){ do i++; while (a[i] < pivot); do j--; while (a[j] > pivot); if (i < j) swap(a[i], a[j]); } if (k <= j) quick_select(l, j); elsequick_select(j + 1, r); }