STL_map
来源:互联网 发布:视听语言 知乎 编辑:程序博客网 时间:2024/05/17 06:04
题目:输入n个数,m次查询,每次查询都输入一个t,输出每次查询的t的个数
例如:n=15
2 2 3 5 4 6 2 1 5 8 9 6 9 8 1
m=3
第一次:t=5 输出:2
第二次:t=2 输出:3
.........
#include<cstdio>#include<algorithm>#include<iostream>//输入输出流#include<map>using namespace std;int main(){map<int,int> d;d.clear();int n,m;cin >> n >> m;//scanf ("%d%d",&n,&m);int t;for (int i = 1 ; i <= n ; i++){scanf ("%d",&t);d[t]++;}for (int i = 1 ; i <= m ; i++){scanf ("%d",&t);//printf ("%d\n",d[t]);cout << d[t] << endl ;}return 0;}
阅读全文
0 0
- STL_map
- STL_map
- STL_MAP
- STL_map
- STL_map
- STL_map用法
- stl_map.h
- STL_map操作
- STL_map用法
- STL_MAP容器常用操作
- stl_map,set 用法
- STL_Map用法详解
- poj2503-Babelfish-STL_map
- 《STL源码剖析》-- stl_map.h
- STL_map——map::begin
- STL_map——map::clear
- STL_map——map::count
- STL_map——map::empty
- 动态内存与智能指针
- LeetCode
- 并发容器
- linux的nohup命令的用法
- vue组件库开发-环境搭建-npm上传
- STL_map
- [日常训练] 藏宝路径
- Sum It Up
- ajax将前台的Map类型数据传到Servlet并解析的方法。
- python基于openCV3的人脸识别
- 收集安卓开发干货
- 排序算法汇总
- 最全的常用正则表达式大全——包括校验数字、字符、一些特殊的需求等等
- Macbook Pro上运行windows to go