B: A and B and Compilation Errors
程序员文章站
2022-04-01 09:36:00
...
#include <stdio.h>
#include <map>
#include <iostream>
using namespace std;
const int MAXN = (int)2e5+10;
map<int, int> mp;
int a[MAXN], b[MAXN], c[MAXN];
int main()
{
int n, x;
while(scanf("%d",&n)!=EOF)
{
for(int i = 0; i < n; ++i)
scanf("%d",&a[i]);
for(int i = 0; i < n-1; ++i)
scanf("%d",&b[i]);
for(int i = 0; i < n-2; ++i)
scanf("%d",&c[i]);
for(int i = 0; i < n-1; i++) *
mp[b[i]]++; *
for(int i = 0; i < n; ++i) *
{ *
mp[a[i]]--; *
if(mp[a[i]] == -1) * 逆向思维
{ *
cout << a[i] << endl; *
break; *
} *
} *
mp.clear(); //注意:集合mp里的元素一定要清空
for(int i = 0; i < n-2; ++i)
mp[c[i]]++;
for(int i = 0; i < n-1; ++i)
{
mp[b[i]]--;
if(mp[b[i]] == -1)
{
cout << b[i] << endl;
break;
}
}
}
return 0;
}