![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lower_bound
MasterSPP
这个作者很懒,什么都没留下…
展开
-
烦恼的高考志愿--lower_bound解法
##烦恼的高考志愿输入4 3513 598 567 689500 600 550输出32首先需要理解lower_bound的用法,参考lower_bound和upper_bound用法#include<bits/stdc++.h>using namespace std;int a[1000005], b[1000005];int main(){ int m, n, sum = 0; cin>>m>>n; a[0] = -1000000原创 2021-03-10 13:14:50 · 307 阅读 · 3 评论 -
lower_bound和upper_bound 用法
lower_bound和upper_bound 用法只适用于一串递增序列lower_bound(迭代器_1, 迭代器_2, x):返回指向a中第一个 【大于等于】 x的元素的迭代器upper_bound(迭代器_1, 迭代器_2, x):返回指向a中第一个 【大于】 x的元素的迭代器举例:int a[] = {1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4};cout << (lower_bound(a, a + 12, 4) - a) << end原创 2021-03-08 22:07:55 · 181 阅读 · 0 评论