zoukankan      html  css  js  c++  java
  • map

    #include <map>
    #include <iostream>
    #include <cstdio>
    #include <cctype>
    using namespace std;
    typedef long long ll;
    map< ll, ll > mp;
    inline ll read () {
        ll x=0,f=1;
        char ch=getchar();
        while(!isdigit(ch)) {
            if(ch=='-') f=-1;
            ch=getchar();
        }
        while(isdigit(ch)) {
            x=(x<<1)+(x<<3)+(ch^48);
            ch=getchar();
        }
        return x*f;
    }
    int n;
    signed main() {
        n=read();
        for(register int i=1; i<=n; i++) {
            ll x=read(),y=read();
            mp[x]=y;
        }
        for(map < ll, ll >::iterator it=mp.begin(); it!=mp.end(); it++) {
            printf("mp[%lld]->%lld
    ",it->first,it->second);
        }
        return 0;
    //    begin()         返回指向map头部的迭代器
    //    clear()        删除所有元素
    //    count()         返回指定元素出现的次数
    //    empty()         如果map为空则返回true
    //    end()           返回指向map末尾的迭代器
    //    equal_range()   返回特殊条目的迭代器对
    //    erase()         删除一个元素
    //    find()          查找一个元素
    //    get_allocator() 返回map的配置器
    //    insert()        插入元素
    //    key_comp()      返回比较元素key的函数
    //    lower_bound()   返回键值>=给定元素的第一个位置
    //    max_size()      返回可以容纳的最大元素个数
    //    rbegin()        返回一个指向map尾部的逆向迭代器
    //    rend()          返回一个指向map头部的逆向迭代器
    //    size()          返回map中元素的个数
    //    swap()           交换两个map
    //    upper_bound()    返回键值>给定元素的第一个位置
    //    value_comp()     返回比较元素value的函数
    }

     例题

    不存在十全十美的文章 如同不存在彻头彻尾的绝望
  • 相关阅读:
    [computer graphics]世界坐标系->相机坐标系详细推导
    [Computer Vision]霍夫变换直线检测
    [OpenGL](翻译+补充)投影矩阵的推导
    [WebGL]二维变换
    [WebGL]Shader中的数据和简单的工作流
    图像梯度
    皮肤镜图片毛发去除
    胸部CT提取分割肺部
    医学影像重采样
    ES7学习笔记(十二)高亮 和 搜索建议
  • 原文地址:https://www.cnblogs.com/qf-breeze/p/10341203.html
Copyright © 2011-2022 走看看