如果一个长度为
2
n
2n
2n的数组中存在至少
n
n
n对
p
i
<
p
i
+
1
p_i
注意在除2的时候要使用逆元=
#include#include #include #include #include #include #define BUFF ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; const int mod = 1e9 + 7; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; typedef long long LL; LL f[N * 2]; void ff() { f[1] = 1; for (int i = 2; i <= N * 2 - 1; i++) f[i] = (f[i - 1] * i) % mod; } LL quick_mi(LL a, LL b, LL p) { LL sum = 1; while (b) { if (b & 1) sum = (sum * a) % p; b >>= 1; a = (a * a) % p; } return sum % p; } void work() { LL n; cin >> n; ff(); cout << f[n * 2] * quick_mi(2, mod - 2, mod) % mod << endl; } int main() { BUFF; LL T; cin >> T; while (T--) work(); return 0; }



