1038
2017-09-03 本文已影响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;
}