题意
给定n,先给n个字符串为A组,再给n个字符串为B组,使A与B一 一对应(即相同),最少能剩多少对不对应的?
思路
难在题意。。。恶心本体题意
用mulitset就好了,先把a都放进去,然后遍历B对应一个删一个,剩下元素个数就是答案。
#include<bits/stdc++.h>
using namespace std;
int n;
string str;
multiset<string> s;
int main()
{
scanf("%d", &n);
for(int i = 0; i < n; i++) cin >> str, s.insert(str);
for(int i = 0; i < n; i++)
{
cin >> str;
auto pos = s.find(str);
if(pos != s.end()) s.erase(pos);
}
printf("%d\n", s.size());
}
/*
3
XS
XS
M
XL
S
XS
*/