二分
文章平均质量分 82
jerans
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Can you solve this equation?
二分,函数递增,所以可以先确定y的区间,不在区间则为No solution! Description Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100; Now please try your lucky.原创 2016-09-21 18:40:33 · 235 阅读 · 0 评论 -
算法训练 一元三次方程求解 二分
算法训练 一元三次方程求解 时间限制:1.0s 内存限制:256.0MB 问题描述 有形如:ax3+bx2+cx+d=0 这样的一个一元三次方程。给出该方程中各项的系数(a,b,c,d 均为实数),并约定该方程存在三个不同实根(根的范围在-100至100之间),且根与根之差的绝对值>=1。要求三个实根。。 输入格式 四个原创 2017-04-26 21:47:53 · 2050 阅读 · 0 评论 -
Codeforces Round #417 (Div. 2)Sagheer, the Hausmeister 乱搞 Sagheer and Nubian Market 二分
B. Sagheer, the Hausmeister time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Some people leave the lights at原创 2017-06-02 09:47:58 · 539 阅读 · 0 评论 -
Codeforces Round #422 (Div. 2) C. Hacker, pack your bags! 思维排序或二分
题目:http://codeforces.com/contest/822/problem/C 题意:给多个区间,每个区间都有一个权值,求两个长度和为x的区间的最小权值和。 思路1:像这种找两个区间的问题,对于每个区间只需考虑在他左面的或只需考虑在他右面的即可,不需要都考虑,就像区间1 区间2 和区间2 区间1 效果是一样的 维护一个need【i】表示长度为i的区间的最小权值,至于如何保证原创 2017-07-17 15:08:07 · 440 阅读 · 0 评论 -
Codeforces Round #424 (Div. 2)C. Jury Marks 暴力 D. Office Keys 二分 E. Cards Sorting 树状数组
C:http://codeforces.com/contest/831/problem/C。 题意:给两个序列a和b 有一个初始值,不断的加ai,要求是在加的过程中b的所有值都出现过,求这样满足条件的初始值有几个。 崩了,这么水的暴力竟然没想出来?? 先把所有的b值标记出来,随便选一个b,暴力放到某一个a后面,这样就可以直接找出原序列,看看b数组里的值是不是都出现过,如果出现过则这个序列满原创 2017-07-17 16:22:51 · 598 阅读 · 0 评论 -
Codeforces Round #426 (Div. 2) C. The Meaningless Game 思维 D. The Bakery dp
题目:http://codeforces.com/contest/834/problem/C 题意:两个人玩游戏, 两个人初始值都为1,每次可以选一个正整数,一个人乘以这个正整数的平方,一个人乘以这个正整数,给你多对数,判断会不会出现这个游戏局面 把ab乘起来,判断是不是一个数的三次方,并且是不是能被a和b整除 k^3==a*b&&a%k==0&&b%k==0 结果找k的二分写错了。。。。原创 2017-07-31 11:07:30 · 627 阅读 · 0 评论 -
hdu 6070 Dirt Ratio 二分,线段树
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6070 题意:定义一个区间的值为(不同数的个数/区间长度),求所有区间内的最小值 有一种01分数规划的思想,二分结果值now,这样只要存在一个区间使得这个值 也就是 dif/(r-l+1) dif dif+l*now 这样O(n)枚举每一个r,并且要快速的确定dif+l*now的最小值,l*n原创 2017-08-03 21:58:39 · 461 阅读 · 0 评论 -
hdu-Sort 二分
http://acm.hdu.edu.cn/showproblem.php?pid=5884 二分加多叉哈夫曼树 优雅的优先队列可以卡过,但必定不会有双队列O(n)写更优雅,学到了 需要注意的坑点是,k叉哈夫曼树,每次减少k-1个元素,当(n-1)%k!=0时,也就是每次减掉k-1个,最后剩的数多于一个时 如果最后在拿掉这些并不是最优的,最后必然剩很多大数,更优的策略应该是先拿掉这些多余的原创 2017-09-23 01:16:59 · 237 阅读 · 0 评论 -
hdu-5726 GCD 思维||二分
http://acm.hdu.edu.cn/showproblem.php?pid=5726 两种做法,一个是仿照hdu5869 的那种做法,好写很多,复杂度也较优,不得不说那个思维很强 hdu-5869: 1575ms #include using namespace std; const int maxn=1e5+10; vector >w[maxn]; int a[maxn]; ma原创 2017-09-23 01:24:01 · 308 阅读 · 0 评论 -
HDU - 6031 Innumerable Ancestors
题意:给一棵树,m次查询, 每次查询给两个集合, 从这两个集合里分别选一个结点,使得这两个节点的lca的深度最大。考虑dfs序为5,6,7的三个节点,5,6的lca深度一定大于等于5,7的lca深度所以可以讲查询集合按dfs序排序,然后类似尺取的操作,使得每一对dfs序接近的节点都做一次lca,选一个最深的就可以了#include<bits/stdc++.h> using namesp...原创 2018-04-09 10:47:01 · 241 阅读 · 0 评论 -
hdu/3717//UVALive - 5012 Rescue 二分加思维
Rescue Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 975 Accepted Submission(s): 260 Problem Description The princess is trapp原创 2017-04-20 00:10:31 · 370 阅读 · 0 评论 -
POJ - 2182 D - Lost Cows 暴力//树状数组加二分
Lost Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11614 Accepted: 7465 Description N (2 <= N <= 8,000) cows have unique brands in the range 1..N.原创 2017-03-15 12:55:33 · 366 阅读 · 0 评论 -
B. The Meeting Place Cannot Be Changed
B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output The main road in Byt原创 2017-03-06 21:24:00 · 660 阅读 · 0 评论 -
qduoj 帅气的HYC切蛋糕
#include #include #define exp 1e-12 double judge(double x); double m; double pi; double h,R,r; int main() { pi=acos(-1.0); double le,ri,mid; while(scanf("%lf %lf %lf",&h,&R,&r)!=EOF) { le=0;ri原创 2016-11-03 13:11:05 · 327 阅读 · 0 评论 -
Codeforces Round #377 (Div. 2)D - Exams
D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has an exam period which will continue for原创 2016-10-20 21:14:22 · 388 阅读 · 0 评论 -
Codeforces Round #380 (Div. 2,Based on Technocup 2017 - Elimination Round 2)C - Road to Cine//
C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service原创 2016-11-23 21:45:08 · 657 阅读 · 0 评论 -
Codeforces Round #398 (Div. 2) D. Cartons of milk
D. Cartons of milk time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Olya likes milk very much. She drinks k原创 2017-02-20 19:42:07 · 326 阅读 · 0 评论 -
Codeforces Round #393 (Div. 2) B. Frodo and pillows
B. Frodo and pillows time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output n hobbits are planning to spend the nig原创 2017-01-29 21:02:36 · 372 阅读 · 0 评论 -
Codeforces Round #379 (Div. 2) C. Anton and Making Potions//734C
C. Anton and Making Potions time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Anton is playing a very interes原创 2016-11-16 16:11:53 · 314 阅读 · 0 评论 -
Pie
Pie Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description My birthday is coming up and traditionally I'm serving pie. Not just one pi原创 2016-09-27 21:51:01 · 262 阅读 · 0 评论 -
Codeforces Round #404 (Div. 2) C. Anton and Fairy Tale
C. Anton and Fairy Tale time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Anton likes to listen to fairy tales原创 2017-03-20 11:31:55 · 219 阅读 · 0 评论 -
CodeForces - 361D Levko and Array二分加dp
D. Levko and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Levko has an array that consists of inte原创 2017-03-10 14:25:24 · 804 阅读 · 0 评论 -
CodeForces - 626E 三分
题意:给n个数,从这n个数里,任意选一些数,使得这些数的平均值减去中位数尽可能的大精度卡的好恶心啊。。。。。首先发现集合个数一定是奇数,任何一个个数为偶数的集合,都可以通过去掉中间较大的那个数,来增大或不变这个值如1 2 3 4 可以去掉3变成1 2 4排序后,枚举每个数做中位数,然后三分集合个数确定中位数之后,剩下的数肯定是越大越好,会发现这个值并不是随着集合个数单调变化的,所以要三分求凸点。直...原创 2018-04-16 12:48:32 · 444 阅读 · 0 评论
分享