杭电acm find your present (2)

题目地址:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1&sectionid=2&problemid=11

使用异或,有个注意的问题就是不能使用cin,实在是太慢了。

c++ 源码:

#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n)==1&&n!=0){
        int res=0,b;
        for(int i=0;i<n;i++){
            scanf("%d",&b);
            res =res^b;
        }
        printf("%d
",res);
    }
    return 0;
}
原文地址:https://www.cnblogs.com/jackwuyongxing/p/4523742.html