本文主要是介绍寻找舞伴,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
牛客网题目链接
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
using namespace std;
int main(){int m, n, x;while(cin>>m>>n){unordered_map<int, int> mp;while(m--){cin>>x;mp[x]++;}int res = 0;while(n--){cin>>x;if(mp[x] > 0) res++;mp[x]--;}cout<<res<<endl; }return 0;
}
这篇关于寻找舞伴的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!