上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: 求卡特兰数的模板 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5+10,mod = 1e9+7; int qpow(int a,int b,int p){ int res=1; 阅读全文
posted @ 2022-05-11 19:56 xhy666 阅读(33) 评论(0) 推荐(0)
摘要: ##组合数各种性质及定理 //方法1 把每个Cab通过递推式预处理(n<=1e4,b<=a<=2e3) #include<bits/stdc++.h> using namespace std; const int N = 2010,mod = 1e9+7; int C[N][N]; void ini 阅读全文
posted @ 2022-05-11 14:37 xhy666 阅读(44) 评论(0) 推荐(0)
摘要: sg=mex({mex(s1),mex(s2}...mex{sn}) sg(a,b)=sg(a)^sg(b) 阅读全文
posted @ 2022-05-11 14:30 xhy666 阅读(21) 评论(0) 推荐(0)
摘要: 感到疑惑 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 5010; LL f[N][N],sum[N]; int main(){ int n,m,k,a; cin>>n>>m>>k; 阅读全文
posted @ 2022-05-10 22:31 xhy666 阅读(28) 评论(0) 推荐(0)
摘要: 步数 <= 3n的做法:从左到右遍历原串,遇到与目标串不符的位就进行一次操作(每次操作包含三步) 步数 <= 2n的做法:从左到右遍历原串,如果s[i]!=s[i+1]就进行一次操作(每次操作包含一步),这样总能将原串变为均为1或均为0,目标串同理 #include<bits/stdc++.h> u 阅读全文
posted @ 2022-05-10 18:49 xhy666 阅读(28) 评论(0) 推荐(0)
摘要: 状压dp,模板 f[i][j]表示以i为当前状态,j为终点的路径长度,属性:min #include<bits/stdc++.h> using namespace std; const int N = 21,M = 1<<20; int f[M][N],weight[N][N]; int main( 阅读全文
posted @ 2022-05-10 12:50 xhy666 阅读(48) 评论(0) 推荐(0)
摘要: 状压dp 模板 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 12, M = 1<<11; LL f[N][M];//状态表示(f[i][j],i表示第i列,j表示以二进制存储的从第i 阅读全文
posted @ 2022-05-09 23:25 xhy666 阅读(35) 评论(0) 推荐(0)
摘要: 补题 阅读全文
posted @ 2022-05-09 19:41 xhy666 阅读(34) 评论(0) 推荐(0)
摘要: 贪心,将字符串分成多个二元子串,如果是01或者10就需要操作一次,因为连续的11或者00串不会改变,所以最小子串数即为不需要改变的11或者00串的数量 特殊情况:只有01或者10时,数量为1 #include<bits/stdc++.h> using namespace std; int main( 阅读全文
posted @ 2022-05-09 14:32 xhy666 阅读(71) 评论(0) 推荐(1)
摘要: 闫式dp分析法 状态表示f[i][j]:表示在前i个数中选,且包含第i个数,一共j个数的所有集合,属性:max 状态计算: f[i][j]:当前第j个点已经在第i个位置,那么第j-1个点与第j个点之间的点数个数应该不大于k,那么假设倒数第二个点 即第j-1个点的下标是t 则 i-k<=t<i 那么f 阅读全文
posted @ 2022-05-08 18:12 xhy666 阅读(30) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页