![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分
Wang_SF2015
这个作者很懒,什么都没留下…
展开
-
文章标题HDU 2141:Can you find it?(二分)
Can you find it?DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai原创 2016-07-22 00:07:34 · 291 阅读 · 0 评论 -
文章标题 codeforce 812C Sagheer and Nubian Market(二分)
Sagheer and Nubian Market题目链接 题意:有N个物品(1~n)都有个价值ai,然后S个单位钱,然后要在这n个物品中取k个物品,使得在S 内,k尽可能大,k相等时,所需的钱尽可能少。没件物品的价格是 基础价格ai+k*i(k为所买物品的数目,i为所选物品的下标)。 分析:将所需的物品数二分,每次验证的时候将价格算一下,然后拍一下序。注:注意在计算价格的时候有可能爆int原创 2017-06-02 21:08:39 · 298 阅读 · 0 评论 -
文章标题 CSU 1913 (线段树+二分答案)
CSU 1913题目 链接题意:中文题 分析:首先由于只关心最后的结果,所以op2相当于简单的撤销之前的p个op1的操作,用一个栈模拟一下即可,这样我们就能得到一个只有 op1的操作序列。 再对于保存下的只有 op1 的操作序列,对答案二分,设为 ans 。将数组中大于 ans 的数设为1,小于等于 ans 的数设为0,存到线段树中,然后每个操作 [l,r] 就变成了如下步骤原创 2017-05-31 19:57:04 · 473 阅读 · 0 评论 -
文章标题 CSU 1831: Found(矩阵快速幂)
1831: Found链接 1831: Found 题意:有n个点,从1到n编号,有两个人A,B,A在第1个点,B在第n个点,然后有时间T,每一分钟,A,B都走到邻接的点上去,且在T的时间内不能走到同一点,然后问在第T的时间刚好走到同一点的方式有多少,得到的结果mod9973 分析:由于最多只有10个点,所以可以用0~9来表示当前的位置,然后有两个人,就可以用一个两位数来表示当前两个人的位置,最原创 2017-04-06 14:35:02 · 311 阅读 · 0 评论 -
文章标题 CSU 1828 : Dictionary
1828: Dictionary1828: Dictionary 题意:有a,b,c,d,e,f,g,h,i组成的全排列(字典序),然后给出单词,问这个单词是第几个单词。 分析:显然可以直接用STL里面的next_permutation来就出全排列,然后拍一下序,然后对于每一个查找,可以直接用二分查找位置。 代码:#include<iostream>#include<string>#inc原创 2017-03-30 23:37:11 · 273 阅读 · 0 评论 -
文章标题 CSU 1817 : Bones’s Battery(Floyd+二分)
1817: Bones’s Battery1817: Bones’s Battery 题意:有n个点m每条边的无向带权图,从点ui到vi需要花费电量di,要求对任一起点s到终点e,都能通过充电并且充电的次数不超过k次(在任何一个点都可以充满电)互相到达,问电池的容量最小是多少。 分析:这是我遇到的第一道二分答案,所以一开始不知道怎么做,看了标程后恍然大悟。。 首先,已经明确二分答案了,原创 2017-03-30 00:12:35 · 302 阅读 · 0 评论 -
文章标题 SPOJ PHT : Pigeonhole Tower(二分)
Pigeonhole TowerPigeon SSNA want to build a tower with some wood walls. Let’s describe the tower they want to make:A Tower can consist of different number of level. If a tower contain L levels then 1s原创 2017-01-04 00:05:11 · 568 阅读 · 0 评论 -
文章标题 HDU 2199 : Can you solve this equation?(二分)
Can you solve this equation?Description 现在,给出等式8* X^4+ 7* X^3+ 2* X^2+ 3 * X +6= Y,请找出他在0和100之间的解(包含0和100)。 现在,请你试试运气。。。。 Input 输入的第一行包含一个整数T(1 <= T <=100),表示测试用例的数目。接下来T个数字,每一行都有一个实数Y(abs(Y)<=10^1原创 2016-11-23 16:49:11 · 319 阅读 · 0 评论 -
文章标题 HDU 1969 : Pie(二分)
PieDescription My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my par原创 2016-11-23 16:40:27 · 337 阅读 · 0 评论 -
文章标题 POJ 3272 : Monthly Expense (二分)
Monthly ExpenseDescription Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (原创 2016-11-16 17:53:33 · 410 阅读 · 0 评论 -
文章标题 POJ 1905 : Expanding Rods (二分)
Expanding RodsDescription When a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two so原创 2016-11-16 17:44:03 · 339 阅读 · 0 评论 -
文章标题 HDU 4786 : Fibonacci Tree(最小生成树--kruskal+并查集)
Fibonacci TreeDescription Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decides to solve the following problem: Consi原创 2016-10-30 21:52:47 · 308 阅读 · 0 评论 -
文章标题 HDU 4791 :Alice's Print Service(二分+dp)
Alice’s Print ServiceDescriptionAlice is providing print service, while the pricing doesn’t seem to be reasonable, so people using her print service found some tricks to save money. For example, the原创 2016-10-14 19:05:03 · 332 阅读 · 0 评论 -
文章标题 codeforces 75C:Modified GCD (二分+最大公因数)
Modified GCDDescriptionWell, here is another math class task. In mathematics, GCD is the greatest common divisor, and it’s an easy task to calculate the GCD between two positive integers.A common divis原创 2016-08-02 19:48:05 · 631 阅读 · 0 评论 -
文章标题 codeforces 598F :Gourmet and Banquet(贪心+二分)
DescriptionA gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet knows the schedule: when each of the dishes will be served.For i-th of the dishes he knows tw原创 2016-08-02 19:33:12 · 549 阅读 · 0 评论 -
文章标题POJ 2785:4 Values whose Sum is 0?(二分)
4 Values whose Sum is 0DescriptionThe SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a原创 2016-07-22 08:44:16 · 279 阅读 · 0 评论 -
文章标题HDU2899:Strange fuction?(二分+精度)
Strange fuctionDescriptionNow, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) Can you find the minimum value when x is between 0 and 100. InputThe first line of the input原创 2016-07-22 00:24:44 · 344 阅读 · 0 评论 -
文章标题 coderforces 514D : R2D2 and Droid Army (二分+RMQ预处理)
R2D2 and Droid ArmyAn army of n droids is lined up in one row. Each droid is described by m integers a1, a2, …, am, where ai is the number of details of the i-th type in this droid’s mechanism. R2-D2 w原创 2017-07-30 15:53:10 · 368 阅读 · 0 评论