水题不解释,思路是用map记录一下出现次数,数据也很水 #include #include using namespace std; int main() { int n; map present; while( scanf("%d", &n) && n) { present.clear(); int m; while(n--) { scanf("%d", &m); if(!present.count(m)) present[m] = 1; else present[m]++; } for( map::iterator i = present.begin(); i != present.end(); ++i) if(i->second % 2) { printf("%d\n",i->first); break; } } return 0; }