随笔 - 530
文章 - 0
评论 - 3
阅读 -
10098
12 2022 档案
乘法逆元
摘要:a*b Ξ 1 (mod p) ,则a, b 互为逆元(mod p) 求逆元 1.费马小定理 : p 是一质数, GCD(a,p)==1 , 则 a^(p-1) Ξ 1 (mod p) 由此 a^(p-2) *a Ξ 1 (mod p) , 那么 a^(p-2) 就是a的逆元 2.exgcd #de
阅读全文
状压dp 记录
摘要:https://www.luogu.com.cn/problem/P1896 http://ybt.ssoier.cn:8088/problem_show.php?pid=1593 https://vjudge.net/problem/HDU-3091 https://zoj.pintia.cn/p
阅读全文
树上dp 记录
摘要:http://ybt.ssoier.cn:8088/problem_show.php?pid=1575 http://ybt.ssoier.cn:8088/problem_show.php?pid=1576 http://ybt.ssoier.cn:8088/problem_show.php?pid
阅读全文
区间dp 记录
摘要:http://ybt.ssoier.cn:8088/problem_show.php?pid=1569 http://ybt.ssoier.cn:8088/problem_show.php?pid=1570 http://ybt.ssoier.cn:8088/problem_show.php?pid
阅读全文
字符串 记录2
摘要:http://ybt.ssoier.cn:8088/problem_show.php?pid=1471 字典树板子 http://ybt.ssoier.cn:8088/problem_show.php?pid=1472 "异或",都每个数,在树上每次贪心地走相反地路径 https://loj.ac/
阅读全文
线筛与分解质因数
摘要:求出最小质因数,然后做除法 #include <bits/stdc++.h> using namespace std ; const int N=5e3+1; int vis[N],c[N],tot; int g[N]; void init(int top){ vis[1]=1; int i,j;
阅读全文
字符串 记录
摘要:https://vjudge.net/problem/HDU-3336 http://ybt.ssoier.cn:8088/problem_show.php?pid=1455 给出两个字符串S,T, 求 T在S中出现多少次 hash或kmp http://ybt.ssoier.cn:8088/pro
阅读全文
dp 记录
摘要:https://ac.nowcoder.com/acm/problem/21303 https://ac.nowcoder.com/acm/problem/21314 https://ac.nowcoder.com/acm/problem/21186
阅读全文
数学 记录
摘要:http://ybt.ssoier.cn:8088/problem_show.php?pid=1623 http://ybt.ssoier.cn:8088/problem_show.php?pid=1621 http://ybt.ssoier.cn:8088/problem_show.php?pid
阅读全文
求质因数
摘要:1. 求一个数的质因数 #include <iostream> #include <algorithm> using namespace std; const int N =200; int tot,fac[N]; void getFac(int x){ tot=0; for(int i=2;i*i
阅读全文
多重背包二进制优化
摘要:复杂度 n^2 * logn 类似倍增, 将 num[i] 拆为 1+2+4+ .... ,这样取物品i 时,可以一次多取一些 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const
阅读全文
acwing 280. 陪审团
摘要:第 i个人的得分分别记为 a[i] 和 b[i]m个人必须满足:辩方总分S(a) 和控方总分 S(b) 的差的绝对值最小如果选择方法不唯一,那么再从中选择辨控双方总分之和最大的方案。求最终的陪审团获得的辩方总分 D 控方总分 P, 以及陪审团人选的编号 吧这个绝对值的差的和作为状态 f[ i ] [
阅读全文
275. 传纸条
摘要:#include <iostream> using namespace std ; const int N=51; int n,m,a[N][N],f[N][N][N][N]; int MAX(int a,int b,int c,int d){ if(a<b) a=b; if(c<d) c=d; i
阅读全文
274. 移动服务
摘要:#include "bits/stdc++.h" using namespace std; const int N=202; #define Min(x,y) x=min(x,y) int n,m,a[N][N],f[1002][N][N]; int p[1002]; void sov(){ int
阅读全文
acwing 273. 分级
摘要:#include "bits/stdc++.h" using namespace std; const int N=2e3+3; int n,a[N],b[N],f[N][N]; int A=1e9; void sov(){ int i,j,k; for(i=1;i<=n;i++)b[i]=a[i]
阅读全文
acwing 152. 城市游戏
摘要:#include "bits/stdc++.h" using namespace std; const int N=1e3+3; int n,m,a[N][N],s[N][N]; int A; int w[N],h[N],pp; void sov(int x){ int i,ans=0; pp=0;
阅读全文
acw 145. 超市
摘要:超市里有n件商品,每件商品都有利润v[i] 和过期时间tm[i] , 每天只能卖一件商品,过期商品不能卖。 求可以得到的最大收益 #include "bits/stdc++.h" using namespace std; const int N=1e5+5; struct T{ int v,tm;
阅读全文
acwing 140. 后缀数组
摘要:把字符串S的所有后缀按照字典序排列,排名为 i 的后缀记为SA[ i ] 额外地,我们考虑排名为 i 的后缀与排名为 i-1 的后缀,把二者的最长公共前缀的长度记为 hgt[i] 使用快排、Hash 与二分 求出 两个数组 #include<iostream> #include <algorithm
阅读全文
acwing 139. 回文子串的最大长度
摘要:枚举回文串的中心点 ,二分左右的长度 判断两个字符串时用hash #include<iostream> #include <algorithm> #include <cstring> using namespace std; #define ll unsigned long long const i
阅读全文
一本通1456(哈希表板子
摘要:用map<int,bool> #include "bits/stdc++.h" using namespace std; const int N=1e4+5; #define int unsigned long long const int mod=212370440130137957ll; cha
阅读全文