POJ,HDU...二分搜索
文章平均质量分 85
# POJ--不光是查找值!“二分搜索”
OPA_heiyaa
嗨嗨嗨
展开
-
计蒜客--T2011--二分||线段树
在大学期间,经常需要租借教室。大到院系举办活动,小到学习小组自习讨论,都需要向学校申请借教室。教室的大小功能不同,借教室人的身份不同,借教室的手续也不一样。面对海量租借教室的信息,我们自然希望编程解决这个问题。我们需要处理接下来nn天的借教室信息,其中第ii天学校有r_iri个教室可供租借。共有mm份订单,每份订单用三个正整数描述,分别为d_jdj,s_jsj...原创 2020-04-02 09:26:32 · 194 阅读 · 0 评论 -
POJ--2785--折半枚举
The 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 + b + c + d = 0 . In the followin...原创 2020-02-08 14:54:53 · 384 阅读 · 2 评论 -
POJ--3111--最大化平均值
Demy hasnjewels. Each of her jewels has some valueviand weightwi.Since her husband John got broke after recent financial crises, Demy has decided to sell some jewels. She has decided that she w...原创 2020-02-02 09:28:44 · 218 阅读 · 0 评论 -
ceil和floor函数
在头文件cmath中包含floor(type x),对x向下取整;ceil(type x),对x向上取整;具体实现过程:(很简单,也可以自己写一个函数)#include<cstdio>#include<cmath>#include<iostream>using namespace std;//要求x/y向下向上取整int up_ceil(in...原创 2020-02-01 15:48:02 · 190 阅读 · 0 评论 -
POJ--2456--cows(最大化最小值)
Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).His C (2 <= C &...原创 2020-02-01 15:39:32 · 233 阅读 · 0 评论 -
POJ--1064--(二分)
Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to co...原创 2020-02-01 15:36:28 · 153 阅读 · 0 评论 -
POJ--3685--Matrix--(二分再二分)
有一个N阶方阵 第i行,j列的值Aij =i2+ 100000 ×i+j2- 100000 ×j+i×j,需要找出这个方阵的第M小值.Input第一行输入T代表测试组数.每个测试用例包含2个数字N,M表示在N阶方阵找出第M大值,N(1 ≤N≤ 50,000) andM(1 ≤M≤N×N). 每两个测试用例之间可能有空行Output输出方阵的第...原创 2020-02-01 15:32:43 · 171 阅读 · 0 评论 -
POJ--3579--查找第k大的值
GivenNnumbers,X1,X2, ... ,XN, let us calculate the difference of every pair of numbers: ∣Xi-Xj∣ (1 ≤i<j≤N). We can getC(N,2)differences through this work, and now your task is to find th...原创 2020-02-01 15:31:01 · 277 阅读 · 0 评论 -
POJ--2976--最大化平均值
In a certain course, you takentests. If you getaiout ofbiquestions correct on testi, your cumulative average is defined to be ...原创 2020-02-01 15:26:22 · 174 阅读 · 0 评论 -
POJ--3045--贪心求解
Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope walking and swinging from the trapeze (and the...原创 2020-04-26 10:56:17 · 147 阅读 · 0 评论 -
POJ--3273--最大化最小值
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...原创 2020-02-01 15:18:16 · 243 阅读 · 0 评论 -
POJ--3258--最大化最小值
Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, straight river with a ro...原创 2020-02-01 15:14:32 · 145 阅读 · 0 评论