1038
作者:
峡迩 | 来源:发表于
2017-09-03 10:48 被阅读0次// PATn.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
unsigned long long n;
map<unsigned,unsigned> grade;
unsigned k;
cin >> n;
unsigned tmp;
for (unsigned long long i = 0; i < n; ++i)
{
cin >> tmp;
++grade[tmp];
}
cin >> k;
for (unsigned j = 0; j < k; ++j)
{
cin >> tmp;
if (grade.find(tmp)!=grade.end()) //map的find函数,判断是否包含某键值!
{
cout << grade[tmp];
}
else
{
cout << 0;
}
if ((k - 1) != j)
{
cout << " ";
}
}
system("pause");
return 0;
}
本文标题:1038
本文链接:https://www.haomeiwen.com/subject/thwdjxtx.html
网友评论