Задача C
unknown
c_cpp
2 years ago
619 B
4
Indexable
#include <bits/stdc++.h> using namespace std; const int64_t MOD = 1e9 + 7; int64_t bpow_bitwise(int64_t x, int64_t y) { int64_t z = 1; while (y > 0) { if (y & 1) z = (z * x) % MOD; x = (x * x) % MOD; y = y >> 1; } return z; } int64_t inverse(int64_t x) { return bpow_bitwise(x, MOD - 2); } int main() { ios::sync_with_stdio(false); cin.tie(0); int64_t n; cin >> n; int fact[n + 1]; fact[1] = 1; for (int64_t i = 2; i <= n - 1; ++i) fact[i] = (fact[i - 1] * i) % MOD; cout << (fact[n - 1] * inverse(2)) % MOD; }
Editor is loading...