problemcutter

导航

SPOJ Problem 7742:Onotole needs your help

有一个序列,有一个数只出现一次而其他数都出现两次,要求找出这个数。

异或运算的自反性。。

#include<cstdio>
int n,x,p;
int main(){
    scanf("%d",&n);
    while(n--){
        scanf("%d",&x);
        p^=x;
    }
    printf("%d",p);
}

 

posted on 2015-03-15 15:07  problemcutter  阅读(109)  评论(0)    收藏  举报