![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分查找
Scarlett·S
学海无涯,回头无岸
展开
-
C++ Pat甲级1010 Radix (25 分)(auto,rbegin(),rend(),max_element())
1010 Radix (25 分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for any pa...原创 2019-02-24 16:53:08 · 202 阅读 · 0 评论 -
寻找指定和的整数对-二分
输入n(n<=100000)个整数,找出其中两个数,(假设一定有解),使他们的和等于m.#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int main() { int n,m; int a[100000]; cin >>...原创 2019-03-19 21:10:30 · 680 阅读 · 0 评论 -
农夫和奶牛-二分(未完成没搞懂题目)
农夫 John 建造了一座很长的畜栏,它包括N (2 <= N <= 100,000)个隔间,这些小隔间依次编号为x1,...,xN (0 <= xi <= 1,000,000,000).但是,John的C (2 <= C <= N)头牛们并不喜欢这种布局,而且几头牛放在一个隔间里,他们就要发生争斗。为了不让牛互相伤害。John决定自己给牛分配隔间,使任意两...原创 2019-03-19 21:54:11 · 1603 阅读 · 1 评论