![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM_STL
文章平均质量分 81
lethic
这个作者很懒,什么都没留下…
展开
-
lower_bound: Spider's Web (CF#133)
Spider's Web time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Paw the Spider is making a web. Web-making is a real art,原创 2012-08-17 12:22:44 · 639 阅读 · 0 评论 -
lower_bound()返回值
函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于val的第一个元素位置。如果所有元素都小于val,则返回last的位置 举例如下: 一个数组number序列为:4,10,11,30,69,70,96,100.设要插入数字3,9,111.pos为要插入的位置的下标 则 pos = lower_bound( number, number + 8,转载 2012-08-17 12:25:39 · 474 阅读 · 0 评论 -
upper_bound()返回值
函数upper_bound()返回的在前闭后开区间查找的关键字的上界,如一个数组number序列1,2,2,4.upper_bound(2)后,返回的位置是3(下标)也就是4所在的位置,同样,如果插入元素大于数组中全部元素,返回的是last。(注意:此时数组下标越界!!) 返回查找元素的最后一个可安插位置,也就是“元素值>查找值”的第一个元素的位置 测试代码如下: #include转载 2012-08-17 12:26:56 · 496 阅读 · 0 评论