
二分查找法
THE END GAME
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
G - Cable master
二分时候用while来枚举精度WA… 然后换了一种方法用while枚举就可以了,但mid,r,的floor取整都是错的 但换成 l 就对了… #include<algorithm> #include<cstdio> #include<cmath> #include<iostream> #include<cstring> #include...翻译 2019-04-06 17:07:37 · 210 阅读 · 0 评论 -
暑假集训日记——7.30(牛客)
【一】n的约数 题解: 2)然后很容易发现一个规律:如果两个数的约数个数相同,那么指数大小按递减顺序排列的话所获得的数更小。 举个例子: 6个约数:12=2^2 *3, 18=2 * 3^2 24个约数:360=2^3 *3^2 *5, 540=2^2 * 3^3 *5 因为我们关注的就是寻找最大数目的约数,所以不需要考虑这个满足条件的数字具体是什么,所以直接考虑如何构造约数,使得原数字尽量小,...原创 2019-07-30 21:07:52 · 205 阅读 · 0 评论 -
暑假集训日记——7.1/7.2(codeforce+分块的题)
emmmmmm,受最近集训的影响,看啥都像二分+前缀和…然后超时了 题面: 字母商店橱窗是一个字符串ss,由nn小写拉丁字母组成。正如名字所示,信件在商店里出售。 信件从最左边到最右边一个一个地卖出去。任何客户只能从字符串ss中购买一些字母前缀。 有m的朋友,他们中的第2个叫ti。他们每个人都计划估算如下的价值:如果s/他想要构建他/她所购买的字母的名称,他/她需要购买多少个字母(最短前缀的长度)...原创 2019-07-06 14:05:52 · 332 阅读 · 0 评论 -
暑假集训日记——6.29(快速幂、前缀和、差分、二分、三分)
快速幂、前缀和、差分、二分、三分 ps:一如既往的低效率呢,一天五道题,还欠一个“三分“概念…还得继续努力啊…… 目标:高效率的日常,cf rate++ (Fighing) B - Monitor 题解: 由于数据的量比较大,所以二维数组存不下,所以采用二维指针动态分配内存解决 其余的就是基本的差分问题了 #include<algorithm> #include<cstdi...原创 2019-07-06 14:07:47 · 240 阅读 · 0 评论 -
暑假集训日记——7.3(codeforces)
C. System Administrator 鲍勃在X公司找到了一份系统管理员的工作。他的第一个任务是在m双向直接连接的帮助下连接n台服务器,以便能够通过这些连接将数据从一台服务器传输到任何其他服务器。每个直接连接必须连接两个不同的服务器,每对服务器最多应该有一个直接连接。 Y公司X公司的商业对手,让鲍勃一个他无法拒绝的条件:鲍勃被要求连接服务器以这样一种方式,当服务器索引v失败,其他两个服务器...原创 2019-07-06 14:05:27 · 221 阅读 · 0 评论 -
签到题
题解: 由于答案具有单调性,所以可以二分法,查找每一个范围内的数 又因为是区间的修改,所以可以用差分数组来维护(注意代码的易错点) 差分+二分 #include<algorithm> #include<cstdio> #include<cmath> #include<iostream> #include<cstring> #includ...原创 2019-05-29 20:15:18 · 1905 阅读 · 1 评论 -
华华给月月准备礼物
简单二分 #include<bits/stdc++.h> #define lc ((o) << 1) #define rc ((o) << 1 | 1) using namespace std; typedef long long ll; typedef pair<int,int>Pair; const int N=1e6+5; const ll ...原创 2019-05-21 23:35:19 · 187 阅读 · 0 评论 -
Codeforces Round #552 (Div. 3) D
二分法 #include<algorithm> #include<cstdio> #include<cmath> #include<iostream> #include<cstring> #include<set> #include<vector> #include<string> using nam...原创 2019-04-17 19:56:16 · 127 阅读 · 0 评论 -
C - Monthly Expense
https://vjudge.net/contest/256497#problem/C 最小化最大消费 #include<iostream> #include<cstdio> #include<string> #include<cmath> #include<vector> #include<queue> #include&l...原创 2019-04-17 19:29:51 · 315 阅读 · 0 评论 -
E - River Hopscotch
https://vjudge.net/contest/256497#problem/G /***********最大化最短距离,怕少不怕多************/ #include <iostream> #include <cstring> #include <cstdlib> #include <cctype> #include ...原创 2019-04-16 18:53:14 · 159 阅读 · 0 评论 -
暑假集训日记——8.4( 点分治+康拓展开+组合数)
点分治详解:大佬的博客 P3806 【模板】点分治1 模板代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define inf 999999999 int n,m,len=0,Size; struct node{int x,y,z,next...原创 2019-08-05 12:04:23 · 183 阅读 · 0 评论