摘要: 扩展域并查集 题目: https://ac.nowcoder.com/acm/problem/16884 x是A,x+n是B,x+2n是C #include<stdio.h>const int maxn=150000;int f[maxn];int find(int x){ return x==f[ 阅读全文
posted @ 2021-06-06 21:47 废柴废柴少女 阅读(580) 评论(0) 推荐(0)
摘要: e是幺元 a[ ]e=e[ ]a=a; 例如: 比如[ ]运算是乘法 a*1=1*a=a; 推出幺元e=1; 比如[ ]运算是加法 a+0=0+a=a; 推出幺元e=0; 求a关于[ ]运算的n次快速幂 res=e,temp=a; while(b) { if(n&1) res=res[ ]temp; 阅读全文
posted @ 2021-06-06 16:31 废柴废柴少女 阅读(50) 评论(0) 推荐(0)
摘要: 覆盖问题 题目: https://ac.nowcoder.com/acm/contest/17345/E 思路: 从后往前遍历 不断更新standard 如果比s大,那么ans++ #include<stdio.h>const int maxn=1e6+7;int a[maxn];int n;int 阅读全文
posted @ 2021-06-06 15:12 废柴废柴少女 阅读(96) 评论(0) 推荐(0)
摘要: 题目: https://ac.nowcoder.com/acm/contest/17345/D 思路: 或者是说倒序相加 1Cn1+2Cn2+3Cn3+....(n-1)cn(n-1)+nCnn nCnn+(n-1)Cnn-1+...................1Cn1 ans=[n*(2^n- 阅读全文
posted @ 2021-06-06 11:25 废柴废柴少女 阅读(78) 评论(0) 推荐(0)