码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • STL技巧大赏


    STL技巧大赏

    map
    1. i n s e r t insert insert 没有重复键值,如果新插入的键值与原有的键值重复则覆盖
    2. b e g i n begin begin
    3. e n d end end
    4. c l e a r clear clear 清除所有
    5. c o u n t count count 某个元素出现次数
    6. l o w e r / u p p e r b o u n d lower/upper bound lower/upperbound
    set
    1. 比 m a p map map多 e r a s e ( f r o m , t o ) erase(from,to) erase(from,to) (fron、to是指针)
    vector

    平衡树

    #include
    using namespace std;
    int n;
    vector<int> q;
    int main()
    {
    	scanf("%d",&n);
    	for(int i=1;i<=n;i++)
    	{
    		int op,k;
    		scanf("%d%d",&op,&k);
    		if(op==1) q.insert(lower_bound(q.begin(),q.end(),k),k);
    		if(op==2) q.erase(lower_bound(q.begin(),q.end(),k));
    		if(op==3) printf("%d\n",lower_bound(q.begin(),q.end(),k)-q.begin()+1);
    		if(op==4) printf("%d\n",q.at(k-1));
    		if(op==5) printf("%d\n",q.at(lower_bound(q.begin(),q.end(),k)-q.begin()-1));
    		if(op==6) printf("%d\n",q.at(upper_bound(q.begin(),q.end(),k)-q.begin()));
    	}
    	return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    list
    list<int>list1;
    list.push_back();
    list.push_front();
    list.pop_back();
    list.pop_front();
    list.front();
    list.back();
    list.empty();
    list.size();
    list.clear();
    list.remove(2);//删除列表中值为2的所有元素(or 其他类型)
    list.insert(list.begin()+i,a); //在第i个元素后插入a
    list.erase(list.begin()+i);
    swap(list1,list2);//将list1和list2交换
    list1.splice(list1.begin(),list2);//将list2连接到list1的begin()位置
    list.reverse();//反转
    list.sort();//升序
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    bitset

    b i t s e t bitset bitset 在算导上的简述

  • 相关阅读:
    设计模式——原型模式05
    SSR 实战:官网开发指南
    1.4 软件工程知识
    数据分析 第二周 (条形图,散点图,直方图,numpy运算和数组广播机制)笔记
    高并发高可用--反向代理与负载均衡
    从零开始学网站建设:从需求分析到上线发布
    JAVA设计模式6:代理模式,用于控制对目标对象的访问
    Qcom查看算法库编译工具版本的方法
    【图像】焦距与景深的关系
    存储器-页式存储
  • 原文地址:https://blog.csdn.net/m0_60137414/article/details/127988306
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号