![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
组合数
抠脚老騷
这个作者很懒,什么都没留下…
展开
-
AtCoder Beginner Contest 217
AtCoder Beginner Contest 217 C - Inverse of Permutation #include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; #define int long long typedef long long LL; typedef long long ll; const int INF = 0x3f3f3f3f; //const int inf = 1e18; //con原创 2021-09-06 20:36:25 · 156 阅读 · 0 评论 -
2021牛客寒假算法基础集训营6
2021牛客寒假算法基础集训营6 A 回文括号序列计数 我们定义一个字符串S是回文的,表示S的左右反转和S相同。 我们定义一个字符串是括号序列: 空串是括号序列。 两个括号序列P和Q的拼接是括号序列。 如果P是括号序列,’(’+P+’)'是括号序列。 求长度为 n (0<=n<=10^9) 的回文括号序列的方案数,对 998244353 取膜。 #include <bits/stdc++.h> //#pragma GCC optimize(2) #define int lo原创 2021-03-12 20:49:01 · 137 阅读 · 0 评论 -
组合数
组合数 n<3000 const int N = 2100; int c[N][N]; void init(){ for(int i=0;i<N;i++) for(int j=0;j<=i;j++){ if(j==0) c[i][j]=1; else c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod; } }原创 2021-01-31 12:46:48 · 96 阅读 · 0 评论 -
组合数取模(Lucas)
组合数取模(Lucas) n,m较大且p不为素数的时候 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 10; const int mod = 1e9 + 7; ll pow(ll a, ll b, ll m) { ll ans = 1; a %= m; while(b) { if(b & 1)ans =原创 2020-09-29 17:00:31 · 283 阅读 · 1 评论