题目链接
It is very cold in Harbin in the winter, but it is pretty warm in the Zhengxin Building. Today is Saturday, Teacher ABG want to play a trick on the only one student called NWL because he didn’t finish the MOOC.

At the beginning, every student is in the building. The teacher calls some students to sweep the snow on the playground out of the building, and sometimes he also call some students who are on the playground back to the building. At last, teacher ABG wants to leave only one student, NWL, on the playground out of the building. It means that the teacher ABG calls NWL’s ID ODD times, but called other students’ ID EVEN times, maybe more than twice. Now give you the list describing the students’ ID which the teacher called in order, please tell us NWL’s ID.

Input
The first line is an integer T, describes the number of tests. Then T tests.

In each test, the first line is an integer N, describes the number of IDs on the list.

Then followed N lines, each line contains an integer M, describes one ID on the list.

Output
T lines. Each line, an integer, the NWL’s ID.

Sample Input
3
3
1140310000
1140310000
1140310000
1
1140310002
5
1
2
2
2
2
Sample Output
1140310000
1140310002
1
Hint
1<=T<=10

1<=N<=1,000,000

1<=M<=1,159,999,999

The sum of N in the input file is no more than 3,000,000, all the input are integers and correct.

题意:
很简单,给你N个ID,让你找出出现奇数次的那个ID的是那个;并输出它就ok啦;

解题思路:
**1.**map记录ID 和出现次数;
如果不知道map的使用可以看这篇博客map
2.**异或;更简单;

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include<queue>
#include<stack>
#include<map>
#include <math.h>
#include <string.h>
#define ll long long
#define inf 0x3f3f3f3f3f
using namespace std;
map<string,int>mp;//map
char  ss[5000];
char sss[1000000][15];
int main()
{
    int t,a,w,kk,s,q,nn;
    scanf("%d",&t);
    //memset(ss,0,sizeof(ss));
    while(t--)
    {
        mp.clear();
        scanf("%d",&a);
        for(int i=0;i<a;i++)
        {
            scanf("%s",sss[i]);
            //mp[ss]=1;
            mp[sss[i]]++;//对应键位值加1 
            //cout<<mp[sss[i]]<<endl;
        }
        for(int i=0;i<a;i++)
        {
            //cout<<mp[sss[i]]<<endl;
            if(mp[sss[i]]%2==1){
                printf("%s\n",sss[i]);
                break;
            }
        }
    }
    return 0;
}

#include<iostream>
#include<cstdio>
#include<ctime>
#include<cstdlib>
using namespace std;
int m,t;
int n;
int ans;
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        ans=0;
        scanf("%d",&m);
        for(int i=1; i<=m; i++)
        {
            scanf("%d",&n);
            ans^=n;
        }
      printf("%d\n",ans);
    }
    return 0;
}