题目描述
C++代码
样例
#include<iostream>
#include<algorithm>
#include<vector>
#include<unordered_map>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> vc(n);
vector<int> v(n);
unordered_map<int, int> mp;
bool vis = false;
int ans = -1;
for (int i = 0; i < n; i++)
{
cin >> vc[i];
mp[vc[i]]++;
if (mp[vc[i]] == 1)
{
v.push_back(vc[i]);
}
}
for (int i = 0; i < v.size(); i++)
{
if (mp[v[i]] == 1)
{
ans = v[i];
break;
}
}
if (ans != -1) {
cout << ans;
}
else {
cout << "None";
}
return 0;
}