正好用到set的特性,如果已经存在,删除掉。
// Problem#: 2005
// Submission#: 3177025
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include<iostream>
#include<set>
using namespace std;
int main() {
int test;
while (cin >> test) {
int temp;
set<int> mySet;
while (test--) {
cin >> temp;
if (mySet.count(temp))
mySet.erase(temp);
else
mySet.insert(temp);
}
cout << *mySet.begin() << endl;
}
}