博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
upper_bound()与lower_bound()的使用
阅读量:7103 次
发布时间:2019-06-28

本文共 507 字,大约阅读时间需要 1 分钟。

upper_bound()与lower_bound()的使用

c++中的许多库函数可以使我们的代码量大大减少,也可使问题简单化。很早之前就接触了upper_bound()与lower_bound(),但没怎么去研究

网上很多资料,最后我找到了一个简单易懂的。

#include 
#include
//必须包含的头文件using namespace std;int main(){ int point[10] = {1,3,7,7,9}; int tmp = upper_bound(point, point + 5, 7) - point;//按从小到大,7最多能插入数组point的哪个位置 printf("%d\n",tmp); tmp = lower_bound(point, point + 5, 7) - point;按从小到大,7最少能插入数组point的哪个位置 printf("%d\n",tmp); return 0;}output:42

转载于:https://www.cnblogs.com/fzuljz/p/5713837.html

你可能感兴趣的文章
scrapy-redis实现爬虫分布式爬取分析与实现
查看>>
Android仿微信UI布局视图(圆角布局的实现)
查看>>
docker
查看>>
OKR 方法 学习笔记
查看>>
CG资源网 - Maya教程
查看>>
http://blog.sina.com.cn/s/blog_62e1faba010147k4.html
查看>>
CSS默认可继承样式
查看>>
数据库中树形结构的表的设计
查看>>
关于Cocos2d-x的瓦片地图
查看>>
位置无关码
查看>>
find-k-pairs-with-smallest-sums
查看>>
情绪板携手视觉设计
查看>>
Atitit.php nginx页面空白 并返回500的解决
查看>>
http://blog.csdn.net/LANGXINLEN/article/details/50421988
查看>>
PHP高效率写法(详解原因)
查看>>
Swift 值类型/引用类型
查看>>
【WPF】点击滑动条(Slider),移动滑块(Tick)到鼠标点击的位置
查看>>
[每天五分钟,备战架构师-9]数据库系统
查看>>
[转]WinForm和WebForm下读取app.config web.config 中邮件配置的方法
查看>>
HDU-1903 Exchange Rates
查看>>