![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
尺取法
qq_38232157
这个作者很懒,什么都没留下…
展开
-
HOJ 6103 Kirinriki(尺取法)
尺取法 题目意思: 给出一个字符串s,要求s 的两个不相交的长度相等的子串 sub1, sub2, 使得他们之间的距离 <= m, 求这子串的最大长度。 本题要点: 1、这两个子串不相交,它们会关于某个位置对称。 对称的位置 cut 可能是某个字符,也可能是连个相邻字符的中间位置。 比如字符串 “abcdekaga”, 子串 [0, 2] “abc” 和子串 [5, 7] “kag”, 对称的位置是 下标 3 和 4 之间。 然而,子串 [0, 2] “abc” 和子串 [4, 6] “eka” ,对原创 2020-09-16 19:08:47 · 86 阅读 · 0 评论 -
LA 2678 Subsequence (训练指南,尺取法)
算法竞赛训练指南, 48 页 注意: 1、尺取法,滑动窗口 [L, R] 使得区间内的数的和 大于等于 s , 然后更新最小的区间差值 R - L + 1 2、无解的时候,输出 0 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int MaxN = 100010; int n, s; int seq原创 2020-05-23 15:56:45 · 99 阅读 · 0 评论