8.23

someone has come back

P1160 队列安排

链表:对一个区间连续修改插入删除;
我初始化0为起点。

坑点就是输出的时候要输出换行!

代码

C++下截取字符串

c++字符串的插入与删除操作


map.count(x)

返回map中key为x的元素个数,时间复杂度为O(log n)
map.find(x)

在map中查找key为x的二元组,并返回指向该二元组的迭代器,若不存在,返回map.end(),时间复杂度为O(log n)

find(x);

if(mp.find(s)!=mp.end())

cout<<"Have Found!"<<endl;

map.insert(pair<...,...>)

在map中插入,参数是pair<key.type,value.type>,返回插入地址的迭代器和是否插入成功的bool并成的pair,时间复杂度为O(log n)

PS:insert在进行插入的时候是不允许有重复的键值的,如果新插入的键值与原有的键值重复则插入无效

用法:名称.insert(pair<key的类型,value的类型>);
eg.
mp.insert(make_pair(2,3));

map.erase(参数)

参数可以是pair或者迭代器,返回下一个元素的迭代器,时间复杂度为O(log n)

eg.

map<int,int>::iterator it=mp.begin();

mp.erase(it);

mp.erase(make_pair(2,3));

posted @ 2019-10-08 14:52  设计涉及社稷  阅读(109)  评论(0编辑  收藏  举报