zoukankan      html  css  js  c++  java
  • upper_bound()与lower_bound()使用方法

    #include <iostream>
    #include <algorithm>//必须包含的头文件
    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("%dn",tmp);
     tmp = lower_bound(point, point + 5, 7) - point;////按从小到大,7最少能插入数组point的哪个位置
     printf("%dn",tmp);
     return 0;
    }
    output:
    4
    2


  • 相关阅读:
    newgrp
    netstat
    netlink, PF_NETLINK
    netdevice
    mv
    mplayer
    mpg123
    MOVE
    motd
    more
  • 原文地址:https://www.cnblogs.com/java20130726/p/3218227.html
Copyright © 2011-2022 走看看