
二分查找
Strokess
懂的越少,想的越多。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ 2318 TOYS (二维叉积、二分)
题目链接:http://poj.org/problem?id=2318 题意: 一个箱子,被n个板分为n+1块,标号为0~n已知盒子左上角和右下角的坐标及每个板上下两端的横坐标(板不会交错,且按顺序给出)然后给出玩具的坐标,统计每块空间内玩具个数(保证玩具一定落在空间内) 5 6 0 10 60 0 3 1 4 3 6 8 10 10 15 30 1 5 2原创 2016-08-20 19:08:40 · 490 阅读 · 0 评论 -
POJ 1064 Cable master (二分)
题目链接:http://poj.org/problem?id=1064 题意:N条绳子,长度分别为Li。若从中切割出K条长度相同的绳子,这K条绳子每条最长能有多长。 二分查找,下界为0上界为最大的L,答案不能四舍五入。 用C++可以过,G++WA。。。为什么。。。 #include #include #include #include #includ原创 2016-08-12 15:00:11 · 632 阅读 · 2 评论 -
POJ 2456 Aggressive cows (二分、贪心)
题目链接:http://poj.org/problem?id=2456 题意:n个房子,m头牛,房子有一系列横坐标,问将m头牛塞进房子,每两头牛之间的最大间隔是多少。 二分+贪心。 #include #include #include #include #include #define eps 1e-6 using namespace std; int n,原创 2016-08-12 15:44:23 · 511 阅读 · 0 评论 -
codeforces 732D Exams
题目连接:http://codeforces.com/problemset/problem/732/D 题意:n天,m个考试,n天中的每一天,0代表该天不能考试,其他表示能考哪一门试。m个考试科目每科都有一定的准备时间,准备完了才能考,但不用连续准备。任意一非0的天可以选择考试或者准备考试,问在n天内完成所有科目所花的最少天数,如果不能考完,则输出-1。 二分+贪心。二分枚举天原创 2016-10-18 18:30:08 · 787 阅读 · 0 评论 -
Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem
http://codeforces.com/contest/761/problem/D c[i] = b[i] - a[i],而且b[]和a[]都属于[L, R] 现在给出a[i]原数组和c[i]的相对大小,要确定b[i] 注意c[]数组中没有重复数。 首先对a[]按照c[]排序,这样最小的a[0]一定选择L作为b[0] 往后每次二分L,R,找到能满足b[i]+a[i]>b[i-原创 2017-02-01 11:57:08 · 702 阅读 · 0 评论