![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分 尺取
Dicer_
A imaginative boy!(i think~~)
展开
-
【杭电oj】5806 - NanoApe Loves Sequence Ⅱ
题目链接 题意是说统计一个长度为n的字符串中至少有k个大于等于m的数的字串的个数。 如果输入的时候就直接将大于等于m的元素标记为1,小于的标记为0,则本题就是求含有至少k的1的连续字串的个数。 我用的尺取法。 AC代码 #include<iostream> #include<stdio.h> using namespace std; int a[2100...原创 2018-07-29 09:15:10 · 150 阅读 · 0 评论 -
【Codeforce】 #364 div.2 C. They Are Everywhere (尺取)
题目链接 题目大意:给出一个长度为n的字母串,求最短的包含母串中所有元素的最短字串的长度。 AC代码: #include<iostream> #include<stdio.h> #include<algorithm> #include<string> using namespace std; int main(){ int...原创 2018-07-29 09:21:50 · 95 阅读 · 0 评论 -
【light oj】Trailing Zeroes (III)(二分)
1138 - Trailing Zeroes (III) PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You task is to find minimal natural number N, so that N! contains exactly Q zeroes on th...原创 2018-07-29 09:36:00 · 107 阅读 · 0 评论 -
【杭电oj】1969 - Pie (二分)
题目链接 求给出的n个Pie能分成f+1块的最大面积,不能拼接。 以最大的Pie的面积为二分区间直接二分查找,题目给的误差范围是1e3,我用1e5跑得才过。 AC代码: #include<iostream> #include<stdio.h> #include<algorithm> #include<string> #include...原创 2018-07-29 09:44:50 · 180 阅读 · 0 评论 -
【杭电oj】5178 - pairs(基础二分)
题目链接 求一个序列中一对位置上的数字的差的绝对值小于k的数量。 按升序排序之后,从1-n查找小于a[i]+k的数字的个数,所以可以二分。 答案会超int,记得用long long。 AC代码: #include<stdio.h> #include<iostream> #include<algorithm> using namespace std;...原创 2018-07-29 09:54:06 · 235 阅读 · 0 评论 -
【杭电OJ】4007 - Dave(枚举,尺取)
题目链接 给出n的点,和一个边长L,求在一个边长为L的正方形内最多能出现多少个点。 枚举所有点,在xi-xi+L通过尺取法求出最大值。 AC代码: #include<bits/stdc++.h> using namespace std; int n,L; struct node{ int x,y; friend bool operator <(con...原创 2018-08-02 21:25:14 · 138 阅读 · 0 评论 -
「poj」 2456 Aggressive cows(二分)
题目链接:http://poj.org/problem?id=2456 题意:给出n个点,求其中m个点之间的最大的最小距离。 最大化最小值用二分比较多,这道题初始时&nbsp;l&nbsp;&nbsp;l&nbsp;\ l\ 就是0,&nbsp;r&nbsp;&nbsp;r&nbsp;\ r\ 就是&nbsp;a[n]−a[1]&nbsp;&a原创 2018-08-17 15:09:08 · 88 阅读 · 0 评论