![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分搜索
小天位
这个作者很懒,什么都没留下…
展开
-
poj 2456 Aggressive cows(二分搜索)题解
Farmer John has built a new long barn, with N (2 His C (2 <= C <= N) cows don't like this barn layout and become aggressive towards each other once put into a stall. To prevent the cows from hurti原创 2018-01-22 12:17:39 · 259 阅读 · 0 评论 -
CodeForces - 831D Office Keys
题意解析二分贪心#include <iostream>#include <algorithm>#include <cstdio>#define ll long long#define maxn 100010using namespace std;int n,k,p;int a[maxn],b[maxn];int main(){ cin&...原创 2018-04-03 12:06:44 · 164 阅读 · 0 评论 -
CodeForces - 785C Anton and Fairy Tale
Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:"Once upon a time, there lived an emperor. He was very rich and h...原创 2018-04-03 08:55:15 · 219 阅读 · 0 评论 -
poj 3104 Drying
晾衣服:n件衣服各含a_i水分,自然干一分钟一单位,放烘干机一分钟k单位,求最短时间。1.题目中说了一分钟内只能放一件衣服进烘干机,,我这里想的是一分钟内干了后,拿出来再放别的。(额。。更节约。。)。2.改好了之后,先将水多的放进烘干机,然后把时间记下来,后面如果有自然干的时间大于这个时间的话,就放进烘干机,更新时间。3.自然干:n件衣服可以同时晾。取C(mid) := 能在mid原创 2018-02-06 15:08:58 · 197 阅读 · 0 评论 -
poj3258 River Hopscotch (二分搜索,考虑最大值最小问题)
每年奶牛们都要举办各种特殊版本的跳房子比赛,包括在河里从一块岩石跳到另一块岩石。这项激动人心的活动在一条长长的笔直河道中进行,在起点和距离起点 L 远的终点各有一块岩石 (1 ≤ L ≤ 10^9)。在起点和终点之间,有 N 块岩石 (0 ≤ N ≤ 50000),每块岩石与起点的距离分别为 Di (0 在比赛过程中,奶牛轮流从起点出发,尝试到达终点,每一步只能从一块岩石跳到另一块岩石。当原创 2018-01-26 23:22:13 · 389 阅读 · 0 评论 -
poj2976Dropping tests (二分搜索+还是涉及昨天遇见的o1分数规划)
今年有 n 场 ACM-ICPC 竞赛,小明每场都有资格参加。第 i 场竞赛共有 b[i] 道题。小明预测第 i 场他能做出 a[i] 道题。为了让自己看着更“大佬”一些,小明想让自己平均做出的题数越大越好,也就是最大化大佬度,大佬度的定义如下:为了达到这个目的,小明决定放弃 k 场比赛的参赛资格。请求出最大的大佬度。例如有 3 场小型比赛,题数分别是 5 题、1 题、6 题,小明预测自己原创 2018-01-26 12:51:01 · 213 阅读 · 0 评论 -
poj 3111 K Best (二分搜索+01分数规划)
Demy has n jewels. Each of her jewels has some value vi and weight wi.Since her husband John got broke after recent financial crises, Demy has decided to sell some jewels. She has decided that she原创 2018-01-25 19:43:34 · 332 阅读 · 0 评论 -
poj 3273 Monthly Expense
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 (1 ≤moneyi≤ 10,000) that h原创 2018-01-25 14:43:42 · 186 阅读 · 0 评论 -
poj 3579 Median 中间值(二分搜索)
Given N numbers, X1, X2, ... , XN, let us calculate the difference of every pair of numbers: ∣Xi - Xj∣ (1 ≤ i < j ≤ N). We can get C(N,2) differences through this work, and now your task is to find原创 2018-01-25 12:38:15 · 314 阅读 · 0 评论 -
poj1064 Cable master (二分搜索)
#include #include #include #define INF 1000000using namespace std;int main(){ int n,k; int a[100005]; while(~scanf("%d %d",&n,&k)) { double temp; for(int i=0;i<n原创 2018-01-22 14:09:53 · 256 阅读 · 0 评论 -
【2016 Asia China-Final D题】
题意: 现在有n个蛋糕值,要求把n个蛋糕值摞起来,螺成k层,而每一层得蛋糕值至少是上一层蛋糕值得2倍,求最后最多可以螺成几个蛋糕. 例如第一个样例 1 2 3 4 要成2层,那么有(1 3) (2 4)所以最多可以形成2个 思路是二分枚举最多可以成为多少个 然后看最这个是否满足有k层得这些个 自己再找是否有k个可以满足得时候,完美的写的超时...原创 2018-12-01 13:38:11 · 195 阅读 · 0 评论