上一页 1 ··· 87 88 89 90 91 92 93 94 95 ··· 109 下一页

2019年1月15日

poj2185 kmp求最小覆盖矩阵,好题!

摘要: /* 特征值k=m-next[m]就是最小循环节的长度, m%k就是去末尾遗留长度 */ #include #include #include using namespace std; char strs[10005][100]; int r,c,w,h,f[1050],nxt[10005];//r是行,c是列 void kmp_pre1(char *s){//求一行的nxt数组 ... 阅读全文

posted @ 2019-01-15 19:12 zsben 阅读(220) 评论(0) 推荐(0) 编辑

2019年1月10日

kmp算法专题总结

摘要: next数组的含义:next[i]表示以字符串s的第i个字符为结尾的后缀与s前缀匹配的长度 next数组也可以当做fail数组,即当模式串s[j]与串t[i]不匹配时,只要将j转换到next[j]继续匹配即可 在求s的next数组时,也用同样的原理,当s[j]与s[i]不匹配时,只要将j转换到nex 阅读全文

posted @ 2019-01-10 23:29 zsben 阅读(211) 评论(0) 推荐(0) 编辑

2019年1月9日

bzoj1150 堆应用,好题

摘要: #include using namespace std; #define maxn 100005 #define INF 0x3fffffff #define pa pair int n,k,pre[maxn],nxt[maxn],len[maxn]; priority_queue,greater >q; int main(){ scanf("%d%d",&n,&k); i... 阅读全文

posted @ 2019-01-09 23:54 zsben 阅读(167) 评论(0) 推荐(0) 编辑

poj2442 堆应用

摘要: #include #include #include #include #include #include #include using namespace std; int main() { int t; int n,m; int num1[2010]; int num2[2010]; priority_queue,less > big; ... 阅读全文

posted @ 2019-01-09 20:13 zsben 阅读(107) 评论(0) 推荐(0) 编辑

poj2018 二分+线性dp好题

摘要: /* 遇到求最值,且答案显然具有单调性,即可用二分答案进行判定 那么本题要求最大的平均数,就可以转换成是否存在一个平均数为mid的段 */ #include #include #include #include using namespace std; #define maxn 100005 #define esp 1e-6 int N,L; double a[maxn],b[maxn],... 阅读全文

posted @ 2019-01-09 17:17 zsben 阅读(261) 评论(0) 推荐(0) 编辑

cf799c 树状数组魔改

摘要: 这题的树状数组是用来维护区间最大值的!非常神奇 第一次见到这种用法,其实和区间求和也没什么差别 阅读全文

posted @ 2019-01-09 14:35 zsben 阅读(244) 评论(0) 推荐(0) 编辑

cf807 c 二分好题

摘要: 能够二分判定的前提是能找到一个单调关系,有时候需要将不是单调关系的数据转换成另外的具有单调关系的数据 阅读全文

posted @ 2019-01-09 11:47 zsben 阅读(220) 评论(0) 推荐(0) 编辑

2019年1月8日

cf803c 数论

摘要: 细节很多的题 阅读全文

posted @ 2019-01-08 20:00 zsben 阅读(160) 评论(0) 推荐(0) 编辑

扩展欧几里得,解线性同余方程 逆元 poj1845

摘要: 定理:对于任意整数a,b存在一堆整数x,y,满足ax+by=gcd(a,b) 当d可以整除c时,一般方程ax+by=c的一组特解求法: 1.求ax+by=d的特解x0,y0 2.ax+by=c的特解为(c/d)x0,(c/d)y0 上述方程的通解:(c/d)x0+k(b/d) ,(c/d)y0-k( 阅读全文

posted @ 2019-01-08 13:48 zsben 阅读(225) 评论(0) 推荐(0) 编辑

poj3696 欧拉函数引用

摘要: 不知道错在哪里,永远T 阅读全文

posted @ 2019-01-08 10:55 zsben 阅读(152) 评论(0) 推荐(0) 编辑

上一页 1 ··· 87 88 89 90 91 92 93 94 95 ··· 109 下一页

导航