当前位置:网站首页>repeat_ map mp. find() + mp. erase()
repeat_ map mp. find() + mp. erase()
2022-04-23 00:22:00 【I'll go to bed again】
//
#include<bits/stdc++.h>
using namespace std;
map< int,int > mp;
map< int,int >::iterator it;
int main()
{
int n,k,x,a,b;
while( cin>>n )
{
while( n-- )
{
cin>>a>>b;
mp.insert( make_pair( a,b ) );
}
cin>>k;
while( k-- )
{
cin>>x;
it=mp.find( x );
if( it!=mp.end() )
{
it=mp.erase( it ); // Need a higher version To get c.erase() Return value eg.c++11
cout<<"size:"<<mp.size()<<endl;
if( it!=mp.end() )
cout<<it->first<<" "<<it->second<<endl;
}
}
}
return 0;
}
// 4
// 1 2 3 4 5 6 7 8
// 1
// 3
// size:3
// 5 6
版权声明
本文为[I'll go to bed again]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222153581677.html
边栏推荐
- ArcGIS 地表TIN面数据的符号化
- ArcGIS 城市生活区用地适宜性评价(三)
- L1-074 finish learning C language in two hours (5 points)
- (转)Aspose.words编程指南之DocumentBuilder一
- ArcGIS TIN地表面与栅格地表面的生成与互相转换
- Nodejs + Express login authentication and registration
- Dialogue with Yang jiongwei, fast is reflected in seizing the "bonus". In fact, tob company should run slower
- L1-070 eating hot pot (15 points)
- Communication error between Willem touch screen and Beifu PLC adsparsesymbol invalid array index
- 国产化浪潮下TiDB解决的痛点问题
猜你喜欢

ArcMAP 使用绘图工具添加注记

Utiliser dottrace 6. 0 performance, analyse de mémoire

倍福TwinCAT两台CX控制器之间做ADS通信

我和TiDB的故事 | 毫无准备地不期而遇,却想说与你相遇好幸运

The story of tidb and I met unprepared, but I wanted to say how lucky I was to meet you

Analytic hierarchy process software operation steps (Yaahp)

MySQL installation and basic use tutorial

(transfer) Aspose Words introduction

(转)Matlab R2014a 64位与Visual Studio2015的mex相关问题

Solution for error reporting of biff el6631 and Siemens communication PROFINET
随机推荐
3. Source code
(transfer) remote access to window remote desktop win10 through external network
Progrès de la recherche sur la télédétection des paramètres phénologiques de la végétation
OJ's daily practice -- falling and bouncing ball
Difference between Beifu twincat1260 and tf5010 authorization
EL2124模块接线和引脚含义
Nodejs+express登录鉴权并注册部分
How can domestic engine cocos break through the jungle?
ArcGIS 制作3D规划图纸
ArcGIS urban living area land suitability evaluation (IV)
What are the interfaces of the switch? The article takes you to remember its name and function
ArcGIS 计算地块容积率
TiDB 在连锁快餐企业丨海量交易与实时分析的应用探索
Concurrent reachability analysis (three color marking method)
Dynamic programming: grouping knapsack problem
ArcGIS 城市生活区用地适宜性评价(三)
微软官网下载Net Framework流程
Componentwillunmount uninstall components
倍福TwinCAT两台CX控制器之间做ADS通信
A tikv hard disk usage problem caused by GC not working caused by ticdc exception